Skip to content

Instantly share code, notes, and snippets.

@mpgarate
Created April 28, 2014 01:53
Show Gist options
  • Save mpgarate/11359983 to your computer and use it in GitHub Desktop.
Save mpgarate/11359983 to your computer and use it in GitHub Desktop.
1337 translator
str = "text to translate"
map = {
'A' => '4',
'B' => '|3',
'C' => '(',
'D' => '|)',
'E' => '3',
'F' => '|*|-|',
'G' => '6',
'H' => '|-|',
'I' => '1',
'J' => 'J',
'K' => '|<',
'L' => '1',
'M' => '|\/|',
'N' => '|\|',
'O' => '0',
'P' => '|*',
'Q' => '0,',
'R' => '|2',
'S' => '5',
'T' => '7',
'U' => '|_|',
'V' => '\/',
'W' => '\/\/',
'X' => '><',
'Y' => "\'\/",
'Z' => 'Z',
}
re = Regexp.union(map.keys)
s = str.upcase.gsub(re, map)
puts s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment