Skip to content

Instantly share code, notes, and snippets.

@satyr
Created June 7, 2009 20:58
Show Gist options
  • Save satyr/125488 to your computer and use it in GitHub Desktop.
Save satyr/125488 to your computer and use it in GitHub Desktop.
#!ruby
$> << (<<"."
_ = {_: ''};
#{ (1..9).map{|i| "#{i} = ++0;" }.join }
// 'constructor' => Function
_.______ = _[_.______ =
(c = (_.___ = ''+ {})[5]) + // '[object Object]'
_.___[1] +
(_.____ = ''+ _[_])[6] + // 'undefined'
(''+ !_)[3] +
_.___[6] +
(_._____ = (''+ !'')[1]) + // 'r'
(_.__ = _.____[0 = +'']) + // 'u'
_.___[5] +
_.___[6] +
_.___[1] +
_._____
][_.______];
a = (''+ !_)[1];
b = _.___[2];
d = _.____[2];
e = _.___[4];
f = _.____[4];
// Function(Function('return"..."')())()
_.______(_.______(
_._____ + e + _.___[6] + _.__ + _._____ + _.____[6] + '"' + #{
$<.read.unpack('U*').map{|n|
'"\\\\"+_.__' + ('%04x' % n).gsub(/./, '+\&')
} * ?+
} + '"')())()
.
).gsub(%r{\s+|//.*}, '').gsub(/[0-9a-f]/){
"_.#{$&.to_i(16).to_s(2).tr('01', '_$')}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment