Skip to content

Instantly share code, notes, and snippets.

@freundTech
Last active August 29, 2015 14:16
Show Gist options
  • Save freundTech/4d0e56fc679e9bb8fc26 to your computer and use it in GitHub Desktop.
Save freundTech/4d0e56fc679e9bb8fc26 to your computer and use it in GitHub Desktop.
Arrayify JS
import sys
d = {
'a': "([]+![])[![]+!![]]",
'b': "(typeof(![]))[![]+![]]",
'c': "([]+typeof([]))[!![]+!![]+!![]+!![]]",
'd': "([]+[][[]])[!![]+!![]]",
'e': "([]+!![])[!![]+!![]+!![]]",
'f': "([]+![])[![]+![]]",
'g': "([]+typeof([]+[[]]))[!![]+!![]+!![]+!![]+!![]]",
'h': "\"h\"",
'i': "([]+[][[]])[!![]+!![]+!![]+!![]+!![]]",
'j': "([]+typeof([]))[!![]+!![]]",
'k': "\"k\"",
'l': "([]+![])[!![]+!![]]",
'm': "([]+typeof(![]+![]))[!![]+!![]]",
'n': "([]+[][[]])[![]+!![]]",
'o': "([]+typeof([]))[![]+![]]",
'p': "\"p\"",
'q': "\"q\"",
'r': "([]+!![])[![]+!![]]",
's': "([]+![])[!![]+!![]+!![]]",
't': "([]+!![])[![]+![]]",
'u': "([]+[][[]])[![]+![]]",
'v': "\"v\"",
'w': "\"w\"",
'x': "\"x\"",
'y': "\"y\"", #Could be gotten from typeof symbol, but it can only be generated by Symbol()
'z': "\"z\""
}
args = sys.argv[1:]
input_ = " ".join(args).lower()
output = []
for c in input_:
if c in d:
output += [d[c]]
else:
output += ["\""+c+"\""]
outputstr = "+".join(output)
print(outputstr)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment