Skip to content

Instantly share code, notes, and snippets.

@swhitt
Forked from ryanb/morse.rb
Created June 10, 2010 16:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save swhitt/433238 to your computer and use it in GitHub Desktop.
Save swhitt/433238 to your computer and use it in GitHub Desktop.
def morse s;26.times{|i|s.gsub!(/#{(97+i).chr}/i,"$be5 J8G#T6P'&9Sl/,!-H0cfk".split('').map{|x|(x[0]-31).to_s(3).gsub('2','-').gsub('1','.')}[i])};s;end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment