Skip to content

Instantly share code, notes, and snippets.

@visnup
Forked from huned/homework
Created June 26, 2009 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save visnup/136665 to your computer and use it in GitHub Desktop.
Save visnup/136665 to your computer and use it in GitHub Desktop.
I took 15 minutes, but mine is 4 lines
require 'rubygems'
require 'open-uri'
require 'json'
url = 'http://twitter.com/statuses/user_timeline.json?id=visnup&count=3200'
dates = open(url) { |f| JSON.parse f.read }.map { |e| Date.parse e['created_at'] }
sum = dates.inject(Hash.new(0)) { |s, t| s[t] += 1; s }
sum.keys.sort.each { |k| puts "#{k} (#{sum[k]}) #{'=' * sum[k]}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment