Skip to content

Instantly share code, notes, and snippets.

@mattb
Created January 21, 2013 18:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattb/4588259 to your computer and use it in GitHub Desktop.
Save mattb/4588259 to your computer and use it in GitHub Desktop.
Source code used to produce https://gist.github.com/4588234
ids = [293401191054979074, 293401663698513921, 293401787464040448, 293401934436659200, 293402177140056064, 293402218432983040, 293402263777587202, 293402332853583872, 293402393025077250, 293402466354077698, 293402940637597696, 293403039295995904, 293403262642700288, 293403304124366848, 293403623084404737, 293403854266048512, 293403891633094656, 293404203659964416, 293404415535239168, 293404447453872128, 293404518945783808, 293404594669760512, 293404694401929217, 293405000087003137, 293405024229404673, 293405072929484800, 293405372021108736, 293405406661857281, 293405547682734080, 293405590468845570]
count = ids.size
tweets = ids.map { |i|
puts count
count -= 1
tweet = Twitter.status(i).to_hash
activity = Twitter.status_activity(i).to_hash
tweet.merge(activity)
}
open("tweets.json","w" ) { |f|
f.puts(MultiJson.encode(tweets))
}
tweets.sort_by { |t|
t["favoriters_count"].to_i + t["retweeters_count"].to_i
}.reverse.each { |t|
puts ("*" * ((t["favoriters_count"].to_i + t["retweeters_count"].to_i) / 500) + " " + t['text'] + " (#{t["favoriters_count"].to_i}fav/#{t["retweeters_count"].to_i}rt)")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment