Created
November 28, 2014 18:53
-
-
Save artsobolev/5efee489c44720d1679a to your computer and use it in GitHub Desktop.
Revisions
-
[email protected] created this gist
Nov 28, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ var revealJS = function(s) { var hexAlphabet = Array.apply(null, { length: 10 }).map(Number.call, Number).concat('abcdef'.split('')); var codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303]; return s.match(/(.{4})/g).map(function(b) { return b.split('').map(function(i) { return hexAlphabet[codes.indexOf(i.charCodeAt())] }) }).map(function(c) { return String.fromCharCode(0 + "x" + c.join('')) }).join('') } var invisibleJS = function(s) { return s.replace(/./g, function(b) { var code = '0000' + b.charCodeAt().toString(16); code = code.substring(code.length - 4); return String.fromCharCode.apply(String, code.split('').map(function(a) { hexAlphabet = Array.apply(null, { length: 10 }).map(Number.call, Number).map(function(n) { return n.toString(); }).concat('abcdef'.split('')); codes = [8289, 8204, 8205, 8206, 8207, 8234, 8235, 8236, 8237, 8238, 8298, 8299, 8300, 8301, 8302, 8303]; var idx = hexAlphabet.indexOf(a); return codes[idx] })) }) }