Skip to content

Instantly share code, notes, and snippets.

@drusepth
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drusepth/d6d5ec800543ddafb549 to your computer and use it in GitHub Desktop.
Save drusepth/d6d5ec800543ddafb549 to your computer and use it in GitHub Desktop.
rhyming-renamer
nicks = %w{
lm aji brodes cbgbt dru ek horm ianweller jruby khwain
montgc narada rd reed suroi suscd woodrufb
}
d = File.readlines('dictionary.txt').to_a
puts nicks.map {|nick|
o = nick.downcase!.dup
while (results = d.select{|line| line.chomp.end_with?(nick)}).length == 0 && nick.length > 0
nick = nick[1, nick.length]
end
"#{o} is now #{results.first}"
}.join("\r")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment