Skip to content

Instantly share code, notes, and snippets.

@danprince
Created September 3, 2013 13:40
Show Gist options
  • Save danprince/6424081 to your computer and use it in GitHub Desktop.
Save danprince/6424081 to your computer and use it in GitHub Desktop.
(170) Morse code golf (Ruby)
def t(s)
o=''
s.each_byte{|c|o+='.-|-...|-.-.|-..|.|..-.|--.|....|..|.---|-.-|.-..|--|-.|---|.--.|--.-|.-.|...|-|..-|...-|.--|-..-|-.--|--..'.split('|')[c-65]||' '}
o
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment