Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created November 10, 2014 03:01
Show Gist options
  • Save tmcw/d46de237626126979743 to your computer and use it in GitHub Desktop.
Save tmcw/d46de237626126979743 to your computer and use it in GitHub Desktop.
Gist from mistakes.io
letters = ['.-', '-...', '-.-.', '-..',
'.', '..-.', '--.', '....',
'..', '.---', '-.-', '.-..',
'--', '-.', '---', '.--.',
'--.-', '.-.', '...', '-',
'..-', '...-', '.--', '-..-', '-.--', '--..']
.reduce(function(memo, l, i) {
memo[l] = String.fromCharCode(97 + i);
return memo;
}, {});
'-.-- --- ..-\
/..- -. -.. . .-. ... - .- -. -../ \
-- --- .-. ... ./\
-.-. --- -.. . .-.-.-'
.split('/')
.map(function(s) {
return s.split(' ').map(function(s) {
return letters[s];
}).join('');
}).join(' ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment