Created
October 21, 2010 03:52
-
-
Save adrianpike/637902 to your computer and use it in GitHub Desktop.
Simple word count of Rumble resource_used stats. make it bettar!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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