SteemSnippets 1.2.3 : Power up, get active votes and get lastest posts from tags

in #utopian-io6 years ago (edited)

image.png

Hello,

steemsnippets is a project that I really like but with my work with steempress and since I've covered most of the usual snippets I don't get to add new snippets very often.

But recently I added a big one and so I figured I'd do a post to let you guys know about the new snippets that I've been adding over the last month.

Special mention to @tdre who submitted two pull requests to add a snippet and fix various things :)

New snippets :

Get active votes

By "active votes" I mean "votes on posts that are awaiting payout". This was harder than expected. Because you can't just look at the date of the vote and be like "ok this vote is younger than 7 days so it's active". Because if you vote on a 5 days old post, your vote will be 3 days old when the post will get its payout.

So I had to go for this workflow :

  • get all the votes of one account
  • Look at those who are younger then 6 days
  • Look at the posts of those votes and check their ages
  • If these posts are younger than 6 days THEN we add them to the "active posts" list.

I check the date of the votes first so I don't have to look over every single post but rather only the one we suspect to be active.

https://github.com/drov0/steemsnippets/commit/5672ed3ab6220ccd19e3a7f0735a994d36ac05b9

Power up

This snippet allows you to easily power up from your balance to steem, I needed that for the https://github.com/drov0/Steem-reward-manager

It's really straightforward, just make sure that the "amount" field follow the steem way of writing things : it must be written like this : x.xxx unit eg : '1.265 STEEM' or '0.010 STEEM'

https://github.com/drov0/steemsnippets/commit/f70f32b742a59ec3a4cf5679396d2397034a5142

Get lastest posts

Made by @tdre

This snippet allows you to query the blockchain to get the latest posts of a tag. This is very usefull if you want to try to make a statistics bots or create your own front end.

What's really important here is that the query is documented.

https://github.com/drov0/steemsnippets/commit/170d23c71780ab86a65b95f2c88b8f5febdd2aee

The project is open source so feel free to submit pull requests with your own snippets :)

@howo



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Thanks !

Hey @emrebeyler, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Hey, @howo!

Would be nice if you included a link to a project overview into article's header. I just came across and can't get what SteemSnipets are for so easily.

Cheers!

Ah ! That's very true ! I kinda forgot to write that.

You can find all the infos about the project here : https://steemit.com/programming/@howo/introducting-steemsnippets

Wow! These are pretty powerful chunks of code! Great community support.

Thanks ! I struggled so much to make stuff work when I started coding steem stuff that I was like "People need to have easy to use snippets"

Thank you for good post, very useful..

I'm still a bit new to Steemit and don't really understand the importance of the voting age snippet. Could you maybe explain it a bit more? Why does it matter that the post pays out 3 days before your vote?

Hey @howo I am @utopian-io. I have just upvoted you!

Achievements

  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

ummmm I had not thought about it before, it seems like an excellent idea

Power up, get active votes and get lastest posts from tags. howo (61) in utopian-io • 18 minutes ago ... snippets I don't get to add new snippets very often. But recently I added a big one and so I figured I'd do a post to let you guys know about the new snippets that I've been adding over the last month.

A very nice post howo, this is very useful for the crowd and especially for myself.

I get a new knowledge from your article.

Thanks for sharing and hopefully you will be more successful for your work ... :)

Check my article about This is the final stage of madness! and if u want give me your feedback!

My article here This is the final stage of madness!

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.033
BTC 64093.86
ETH 3123.80
USDT 1.00
SBD 3.94