Skip to content

Instantly share code, notes, and snippets.

@everget
Created February 12, 2017 14:02
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 everget/f3341e51a1176f152c66c926e31308ee to your computer and use it in GitHub Desktop.
Save everget/f3341e51a1176f152c66c926e31308ee to your computer and use it in GitHub Desktop.
The new look at scripting process...
// ArrayScript...or as I would have nothing to do
let testSuite = [
'Awesome',
'epic fail',
'remember,remember',
'to be or not to be...',
'DealerPoint is awesome...',
'The best code is the one that doesn`t exist...',
'Whatever the mind can conceive and believe, the mind can achieve. — Napoleon Hill',
'The difference between stupidity and genius is that genius has its limits. — Albert Einstein',
'If we don`t end war, war will end us. — Herbert Wells',
'That which does not kill us makes us stronger. - Friedrich Nietzsche',
];
/**
** TODO letters
* g
* h
* k
* q
* x
* y
* z
*/
const ASCompiler = (function (global) {
let dict = {
'a': '((+[][[]]+[]+[])[+!+[]])', //or ([]/[]+[])[+!+[]];
'b': '(([]+{})[+!+[]+!+[]])',
'c': '(([]+{})[+[+!+[]+[+[]]]/[!+[]+!+[]]])',
'd': '(([][[]]+[])[!+[]+!+[]])',
'e': '(([]+{})[!+[]+!+[]<<+!+[]])',
'f': '((![]+[])[+[]])',
'i': '(([![]]+[][[]])[+!+[]+[+[]]])', //or ((+!+[]/+![])+[])[+!+[]+!+[]+!+[]]
'j': '(([]+{})[+!+[]+!+[]+!+[]])',
'l': '((![]+[])[!+[]+!+[]])',
'm': '(((+[][[]]).constructor+([]+[]))[[([]+[])+(+!+[])+(+!+[])]])',
'n': '(((!+[])[+[]]+[])[+!+[]])',
'o': '(([]+{})[+!+[]])',
'p': '((prompt+([]+[]))[+[+!+[]+[+[]]]-+!+[]])',
'r': '(((!+[])+[])[+!+[]])',
's': '((![]+[])[+!+[]+!+[]+!+[]])',
't': '((!![]+[])[+[]])',
'u': '(([][[]]+([]+[]))[+![]])',
'v': '((eval+[])[+[+!+[]+[+[]]]])',
'w': '((this+([]+[]))[[+!+[]+[+[]]]/[!+[]+!+[]]+(!+[]+!+[]<<!+[]+!+[])])',
'A': '([].constructor+[])[+[+!+[]+[+[]]]-+!+[]]',
'B': '(((![]).constructor+[]+[])[+[+!+[]+[+[]]]-+!+[]])',
'D': '(document+[])[[]+(+!+[])+(+!+[]+!+[])]',
'I': '(((+(+!+[]+[+[]])/+![])+[])[+![]])',
'P': '(isPrototypeOf+[])[+[[]+(+!+[])+(+!+[])]]',
'W': '((constructor+([]+[]))[+[+!+[]+[+[]]]-+!+[]])',
'.': '((+![]).toFixed(+!+[])[+!+[]])',
',': '([]+[,,])',
' ': '(([]+{})[7])',
'0': '(+[])', // {} + [] /or/ +![]
'1': '(+!+[])',
'2': '(!+[]+!+[])',
'3': '(+!+[]+!+[]+!+[])',
'4': '(!+[]+!+[]<<+!+[])',
'5': '([+!+[]+[+[]]]/[!+[]+!+[]])',
'6': '(+!+[]+!+[]+!+[]<<+!+[])',
'7': '((+!+[]+!+[]+!+[]<<+!+[])+!+[])',
'8': '(!+[]+!+[]<<!+[]+!+[])',
'9': '(+[+!+[]+[+[]]]-+!+[])'
};
return function ASCompiler(text) {
let len = text.length;
let i = -1;
let result = '';
while (++i < len) {
if (dict.hasOwnProperty(text[i])) {
result += dict[text[i]];
result += '+';
}
}
let bracketPos = result.lastIndexOf(')');
return result.slice(0, bracketPos + 1);
}
})(window);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment