Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created November 10, 2014 03:01
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 tmcw/6b1434fc52ca05c085dc to your computer and use it in GitHub Desktop.
Save tmcw/6b1434fc52ca05c085dc 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