Skip to content

Instantly share code, notes, and snippets.

@SansWord
Created February 13, 2014 04:02
Show Gist options
  • Save SansWord/8969533 to your computer and use it in GitHub Desktop.
Save SansWord/8969533 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
</body>
</html>
$ = ~[]; // -1
$ = {
___: ++$, // 0
$$$$: (![] + "")[$], // "f"
__$: ++$, // 1
$_$_: (![] + "")[$], // "a"
_$_: ++$, // 2
$_$$: ({} + "")[$], // "b"
$$_$: ($[$] + "")[$], // "d"
_$$: ++$, // 3
$$$_: (!"" + "")[$], // "e"
$__: ++$, // 4
$_$: ++$, // 5
$$__: ({} + "")[$], // "c"
$$_: ++$, // 6
$$$: ++$, // 7
$___: ++$, // 8
$__$: ++$ // 9
};
// in object $'s key name, $ represents 1, _ represents 0. Hence produce from 0 to 16.
$.$_ = ($.$_ = $ + "")[$.$_$] + ($._$ = $.$_[$.__$ ]) + ($.$$ = ($.$ + "")[$.__$]) + ((!$) + "")[$._$$] + ($.__ = $.$_[$.$$_]) + ($.$ = (!"" + "")[$.__$]) + ($._ = (!"" + "")[ $._$_]) + $.$_[ $.$_$ ] + $.__ + $._$ + $.$;
/* extend global $ with the following map:
{
$_: "constructor",
_$: "o",
$$: "n",
__: "t",
$: "r",
_: "u"
}
$.$_ === "constructor", which can be used to extract needed function.
*/
$.$$ = $.$ + (!"" + "")[$._$$] + $.__ + $._ + $.$ + $.$$; // redefine $.$$ as "return"
$.$ = ($.___)[$.$_][$.$_]; // redefine $.$ as constructor Function
$.$( // calling Function to produce function_1
$.$( // calling Function to produce function_2
$.$$ + "\"" + $.$_$_ + (![] + "")[$._$_] + $.$$$_ + "\\" + $.__$ + $.$$_ + $._$_ + $.__ + "(\\\"\\" + $.__$ + $.__$ + $.__$ + "\\" + $.$__ + $.___ + (![] + "")[$._$_] + $._$ + "\\" + $.__$ + $.$$_ + $.$$_ + $.$$$_ + "\\" + $.$__ + $.___ + "\\" + $.__$ + $.$$$ + $.__$ + $._$ + $._ + ".\\\"\\" + $.$__ + $.___ + ")" + "\""
// "return\"ale\\162t(\\\"\\111\\40lo\\166e\\40\\171ou.\\\"\\40)\""
)() // calling function_2, return a string : "alert(\"I love you.\" )"
)(); // calling function_1, alert("I love you." )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment