This is a chrome extension to help download videos from some video sites. As Google does not allow Youtube download in the extension, I have to cut down lots of features in the original plugin. So here is the simplified version (mini) that supports some common video sites.
以上收益包括75%的作者收益(Author Rewards)和25%的点赞收益(Curation Rewards)。 @dailystats 提供过去7天全网潜在收益前30名的排名 check @dailystats for top 30 daily authors in the last 7 days sorted by potential payout
If you have a following list that you would like to unfollow if he/she is inactive for at least 7 days, you might run the following SQL query (thanks to @arcange ‘s STEEMSQL). Being inactive means that he/she did not make a post or comment.
1 2 3 4 5 6 7 8 9 10
select author, datediff(day, T.last, GetUTCDate()) from ( select author, max(created) "last" from Comments where author in ('followingid1', 'followingid2' ...) group by author ) T where datediff(day, T.last, GetUTCDate()) > 7
The nested SQL groups the posts by author and returns the last activity time, store in column “last”. The main query then further filters out the active users by datediff(day, T.last, GetUTCDate()) > 7
We can further optimise this SQL by storing the date columns in the inner SQL query. The following IDs can be fetched by query the Followers view. So the query becomes:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
select author, T.days from ( select author, max(created) "last", datediff(day, max(created), GetUTCDate()) "days" from Comments where author in ( select following from followers where follower = 'justyy' ) group by author ) T where T.days > 7 order by T.days desc
The above query will list @justyy ‘s most inactive following user IDs, this gives results:
select author, datediff(day, T.last, GetUTCDate()) from ( select author, max(created) "last" from Comments where author in ('followingid1', 'followingid2' ...) group by author ) T where datediff(day, T.last, GetUTCDate()) > 7
select author, T.days from ( select author, max(created) "last", datediff(day, max(created), GetUTCDate()) "days" from Comments where author in ( select following from followers where follower = 'justyy' ) group by author ) T where T.days > 7 order by T.days desc
@kenchung ‘s Contest is fun, as always, thank you!
This puzzle is simple to understand.
If you flip this over 180 degree, you will get
So how many numbers do you need to represent from 0000 to 9999?
First, we need a function to tell if a digit can be flipped… if not, e.g. like 7, we need to return false.
1 2 3 4 5 6 7 8 9 10 11 12
function getRevDig(x) { switch (x) { case 0: return 0; case 1: return 1; case 2: return 2; case 5: return 5; case 6: return 9; case 8: return 8; case 9: return 6; default: return false; } }
Now, given a four digit number, we need to return its flipped version, to get each digit, you can use module operator and division.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
function getRev(x) { var a = x % 10; a = getRevDig(a); if (a === false) return false; var b = Math.floor(x / 10) % 10; b = getRevDig(b); if (b === false) return false; var c = Math.floor(x / 100) % 10; c = getRevDig(c); if (c === false) return false; var d = Math.floor(x / 1000); d = getRevDig(d); if (d === false) return false; return (a * 1000 + b * 100 + c * 10 + d); }
The rest is straightforward, just to check and mark the number and its rotated version in a dictionary-like data structure (or array).
1 2 3 4 5 6 7 8 9 10 11 12 13 14
var total = 0; var a = {}; for (var i = 0; i <= 9999; ++i) { if (!(i in a)) { total ++; a[i] = 1; var x = getRev(i); if (x !== false) { a[x] = 1; } } } console.log(total);
function getRevDig(x) { switch (x) { case 0: return 0; case 1: return 1; case 2: return 2; case 5: return 5; case 6: return 9; case 8: return 8; case 9: return 6; default: return false; } }
给定一个4位数,计算倒过来的数字,如果倒过来无意义,返回FALSE。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
function getRev(x) { var a = x % 10; a = getRevDig(a); if (a === false) return false; var b = Math.floor(x / 10) % 10; b = getRevDig(b); if (b === false) return false; var c = Math.floor(x / 100) % 10; c = getRevDig(c); if (c === false) return false; var d = Math.floor(x / 1000); d = getRevDig(d); if (d === false) return false; return (a * 1000 + b * 100 + c * 10 + d); }
然后就是从0到9999,每次检查是否已经出现了, 否则统计加1,然后把倒过来的数字也标记上了。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
var total = 0; var a = {}; for (var i = 0; i <= 9999; ++i) { if (!(i in a)) { total ++; a[i] = 1; var x = getRev(i); if (x !== false) { a[x] = 1; } } } console.log(total);
以上收益包括75%的作者收益(Author Rewards)和25%的点赞收益(Curation Rewards)。 @dailystats 提供过去7天全网潜在收益前30名的排名 check @dailystats for top 30 daily authors in the last 7 days sorted by potential payout