Skip to content

Instantly share code, notes, and snippets.

@benhowdle89
Created April 22, 2014 13:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benhowdle89/be279560b61a023c76fb to your computer and use it in GitHub Desktop.
Save benhowdle89/be279560b61a023c76fb to your computer and use it in GitHub Desktop.
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