Skip to content

Instantly share code, notes, and snippets.

@plainlystated
Created June 9, 2010 21:40
Show Gist options
  • Save plainlystated/432214 to your computer and use it in GitHub Desktop.
Save plainlystated/432214 to your computer and use it in GitHub Desktop.
def morse s;s.upcase.each_byte.map{|c|c==32?' ':"c 1mn 1mx 5v 1 v5 65 uv b xy 5w xn m l 66 xx 1pg 3d 33 2 34 uw 3e 1mo 1my 1pf".split[c-65].to_i(36).to_s.gsub(/1/,'.').gsub(/2/,'-')}.join;end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment