For more, see the evil.js project: https://github.com/kitcambridge/evil.js Also note that `string.split('').reverse().join('')` is not a very good way to reverse a string in JavaScript. See http://mathiasbynens.be/notes/javascript-unicode#reversing-s...
Hide this in your coworkers' JavaScript code tomorrow
11–20 of 40 posts
Re: Hide this in your coworkers' JavaScript code tomorrow
#12There's the old C prank: #define true false .. but in reality, I had a serious issue with Qt once: #ifndef TRUE #define TRUE true #define FALSE false #endif Now this screwed up some other library's similar definitions...
My favorite (C++) : #define private public
Re: Hide this in your coworkers' JavaScript code tomorrow
#13Re: Hide this in your coworkers' JavaScript code tomorrow
#14Yes kill your coworker's productivity by making her or him even more miserable when dealing with a bug. If you did this and I was your manager, at worst you'd end up on a PIP. If you want conduct a prank do something that doesn't frustrate the work they're paid to do.
Re: Hide this in your coworkers' JavaScript code tomorrow
#15Re: Hide this in your coworkers' JavaScript code tomorrow
#16For more, see the evil.js project: https://github.com/kitcambridge/evil.js Also note that `string.split('').reverse().join('')` is not a very good way to reverse a string in JavaScript. See http://mathiasbynens.be/notes/javascript-unicode#reversing-s...
Re: Hide this in your coworkers' JavaScript code tomorrow
#17On a related note, I got a pleasent surprise when I opened the Developer Console on Facebook.com: they present you with a giant red warningp[1] and block any code execution in it until you explicitly 'allow [your] account to be hijacked if I paste malicious Javascript'[2] [1]: http://i.imgur.com/6UVaTen.png [2]: https://www.facebook.com/selfxss
Facebook blocks the console as it is supposedly used for " exploitation by people to post spam and even used to "hack" accounts" http://stackoverflow.com/questions/21692646/how-does-faceboo...
Yes, maybe people should know that running arbitrary JavaScript is dangerous, but they don't.
Re: Hide this in your coworkers' JavaScript code tomorrow
#18One of my favourite ways to punish JavaScript developers who don't use `var` is to randomly hide a if (false) { var GLOBALVAR; } somewhere in the code. It's fun (in a harmless fun kinda way, but you can also use some really dirty tricks to really hamper someone's work) to fuck up people's code - that's why I wrote Underhanded JavaScript. :P EDIT: Another fun one is to add `return`s to constructor functions.
Re: Hide this in your coworkers' JavaScript code tomorrow
#19 Object.freeze(console)
Or safe JS up entirely: https://gist.github.com/clux/3823024