Skip to content

Instantly share code, notes, and snippets.

@mischa
Created July 8, 2011 21:52
Show Gist options
  • Save mischa/1072917 to your computer and use it in GitHub Desktop.
Save mischa/1072917 to your computer and use it in GitHub Desktop.
x.group_by { |e| e }.tap { |hash| hash.map { |element, elements| hash[element] = elements.size } }.sort_by { |e| e.last }.reverse
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment