Skip to content

Instantly share code, notes, and snippets.

@mcohen01
Created December 5, 2013 21:14
Show Gist options
  • Save mcohen01/7814010 to your computer and use it in GitHub Desktop.
Save mcohen01/7814010 to your computer and use it in GitHub Desktop.
Top letters
s = `curl http://www.giwersworld.org/computers/linux/common-words.phtml`
r = /<pre>[A-Z\n]*<\/pre>/
puts r.match(s).to_s
.split("\n")
.join
.chars
.group_by{|s| s}
.map{|k,v| {k => v.length}}
.sort{|x,y| x.values[0] <=> y.values[0]}
.reverse
.take(10)
.map{|m| m.keys[0]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment