Win A Hacker Monthly Subscription

08 Apr 2011 | By Alex Young | Tags magazines security

Hacker Monthly is a printed and digital magazine that collects the best posts from Hacker News. Issue 11 has this on the cover:

($=[$=[]][(__=!$+$)[_=-~-~-~$]+({}+$)[_/_]+ ($$=($_=!''+$)[_/_]+$_[+$])])()[__[_/_]+__ [_+~$]+$_[_]+$$](_/_)

You may have seen this obtuse piece of JavaScript before — it will display an alert and pop up the browser cookie. Adam Cecchetti reverse engineers this code and explains exactly how it works. I’m fascinated by security, so I enjoyed reading this rare and detailed JavaScript security-related post.

If you’d like to read more from Hacker Monthly, we’ve got 5 digital subscriptions to give away — worth $29 each! Just post a comment with your favourite JavaScript one-liner, and I’ll select 5 winners. Make sure your comment has a way for us to get in touch (a link to a contact form or Twitter account would suffice).

Winners

The response to this was overwhelming, there were some great examples of JavaScript’s strengths, weaknesses, and obscure features.

If you’re a winner, I’ve followed you on Twitter/Facebook, so please follow back and direct message me with an email address that I can send the Hacker Monthly folks.

These are the winners:

א=-~-~[],ב=-~א,ג=({})+[],ד=[].א+[],ה=![]+[],ו=!![]+[],ד[א]+ה[ב-א]+ד[ב+א]+ה[א]+([][ג[א+ב]+ג[ב-א]+ד[ב-א]+ה[ב]+ג[ב+ב]+ו[ב-א]+ו[א]+ג[א+ב]+ג[ב+ב]+ג[ב-א]+ו[ב - א]]+[])[(א<<א)+א+ב]+ג[ב]+ה[ב]

- Golmote

(function ___(__){return function(_){return _!='?' && ___(__+_) || __+'!';};})('d')('a')('i')('l')('y')('j')('s')(' ')('r')('o')('c')('k')('s')('?')

- Florian Cargoet

// From jQuery's $.each():
for ( var value = object[0]; i < length && callback.call( value, i, value ) !== false; value = object[++i] ) {}

- tkazec

Quite a simple one, posted by John Resig, but it felt like a real epiphany when I first saw it:

Array.max = function() { return Math.max.apply(Math, arguments); };
Array.min = function() { return Math.min.apply(Math, arguments); };

- Gary Chambers

// Remove local scope access from eval:
;(function(){var oldEval=eval;eval=function eval() {oldEval.apply(this,arguments)}})();

- Bradley

Francois Laberge’s WebGL Examples

Francois Laberge sent me some cool 3D examples:

He’s working on some interesting WebGL related projects and posts about them on endergen.com.


blog comments powered by Disqus