Last active
April 11, 2017 21:01
-
-
Save sasharevzin/5293c71e45a5e4063af0a3e4b567c6ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//USAGE: in your address bar, type: javascript: and paste compiled string like: | |
//javascript:!function(){function b(b).... | |
//compiled: | |
!function(){function b(b){for(var c=[],d=0;d<b.length;d++){var e=b.charAt(d).toLowerCase(),f=a[e];f||(f=e),c.push(f)}return c.join("")}var a={a:":atrain:",b:":btrain:",c:":ctrain:",d:":dtrain:",e:":etrain:",f:":ftrain:",g:":gtrain:",h:":html:",i:":ie:",j:":jtrain:",k:":kanyemad:",l:":ltrain:",m:":mtrain:",n:":ntrain:",o:":mysql:",p:":python:",q:":qtrain:",r:":rtrain:",s:":strain:",t:":ttrain:",u:":ubuntu:",v:":vim:",w:":wtrain:",x:":x-wing:",y:":y:",z:":ztrain:","?":":question:"},c=prompt("Type a message");alert(b(c))}(); | |
//decompiled | |
(function(){ | |
var ABC = { | |
"a": ":atrain:", | |
"b": ":btrain:", | |
"c": ":ctrain:", | |
"d": ":dtrain:", | |
"e": ":etrain:", | |
"f": ":ftrain:", | |
"g": ":gtrain:", | |
"h": ":html:", | |
"i": ":ie:", | |
"j": ":jtrain:", | |
"k": ":kanyemad:", | |
"l": ":ltrain:", | |
"m": ":mtrain:", | |
"n": ":ntrain:", | |
"o": ":mysql:", | |
"p": ":python:", | |
"q": ":qtrain:", | |
"r": ":rtrain:", | |
"s": ":strain:", | |
"t": ":ttrain:", | |
"u": ":ubuntu:", | |
"v": ":vim:", | |
"w": ":wtrain:", | |
"x": ":x-wing:", | |
"y": ":y:", | |
"z": ":ztrain:", | |
"?": ":question:" | |
}; | |
function print(str){ | |
var messages = []; | |
for (var i = 0; i < str.length; i++) { | |
var char = str.charAt(i).toLowerCase(); | |
var replaced = ABC[char]; | |
if(!replaced){ | |
replaced = char; | |
} | |
messages.push(replaced); | |
} | |
return messages.join(''); | |
} | |
var message = prompt('Type a message'); | |
alert(print(message)); | |
})(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment