Skip to content

Instantly share code, notes, and snippets.

@bumi
Created June 25, 2009 20:22
Show Gist options
  • Save bumi/136138 to your computer and use it in GitHub Desktop.
Save bumi/136138 to your computer and use it in GitHub Desktop.
hashed_result = ["a","b","a"].inject(Hash.new(0)) {|hash,value| hash[value]+=1; hash}
hashed_result.sort{|a,b| b[1] <=> a[1]}.collect{|e| e[0]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment