Skip to content

Instantly share code, notes, and snippets.

@benhowdle89
Created April 22, 2014 13:47
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Permeate algorithm
var len = tweets.length;
while (len--) {
var tweet = tweets[len];
if (tweet.retweeted_status) {
tweets.splice(len, 1);
} else {
tweets[len].score = ((tweet.favorite_count + tweet.retweet_count) / tweet.user.followers_count) * 1000;
}
}
tweets.sort(function(a, b){
return +a.score - +b.score;
}).reverse();
tweets = tweets.slice(0, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment