Skip to content

Instantly share code, notes, and snippets.

@adrianpike
Created October 21, 2010 03:52
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 adrianpike/637902 to your computer and use it in GitHub Desktop.
Save adrianpike/637902 to your computer and use it in GitHub Desktop.
Simple word count of Rumble resource_used stats. make it bettar!
require 'rubygems'
require 'activeresource'
class Team < ActiveResource::Base; self.site = "http://railsrumble.com/"; self.format = :json; end
teams = []
counts = Hash.new(0)
(1..6).each {|n| teams += Team.find(:all, :params => {:page => n}).collect(&:team) }
teams.collect(&:entry).collect(&:resources_used).collect(&:split).flatten.each{|rn| counts[rn] += 1 }
counts.sort {|a,b| b[1]<=>a[1]}.each {|k,v|
printf "#{k} : #{v}\n"
};[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment