Live data from Hacker News

Hide this in your coworkers' JavaScript code tomorrow

gist.github.com

11–20 of 40 posts

Re: Hide this in your coworkers' JavaScript code tomorrow

#11
post #10

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...

Oh... very very very nice. This is amazing

Re: Hide this in your coworkers' JavaScript code tomorrow

#12
post #9

There'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...

Logic inversion should normally be caught rather easily, flow control misdirections not so much : #define if while .

My favorite (C++) : #define private public

Re: Hide this in your coworkers' JavaScript code tomorrow

#13
I did something similar in high school. You dropped a file named "System.java" into a Java project, which then intercepted all calls to System.out.println() and, for example, printed the text backwards, very slowly, or googled the text in Firefox:

https://github.com/blinry/fake-java-println

Re: Hide this in your coworkers' JavaScript code tomorrow

#14
post #4

Yes 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.

Making the text print out in reverse is cute because they should be expected to have a "WTF?" second and then move on. I would expect that messing with the printed order of elements would backfire badly.

Re: Hide this in your coworkers' JavaScript code tomorrow

#16
post #10

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...

Evil.js looks like a lot of fun. Love that whole article, by the way. Very thorough.

Re: Hide this in your coworkers' JavaScript code tomorrow

#17
post #5

On 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...

When you consider Facebook's target audience, it's probably okay to make people like us jump through a hoop in order to stop Grandma from being completely p0wned by typing in some JavaScript.

Yes, maybe people should know that running arbitrary JavaScript is dangerous, but they don't.

Re: Hide this in your coworkers' JavaScript code tomorrow

#18
post #7

One 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.

I haven't had my morning coffee; can you explain what this breaks? I know JavaScript's scoping rules are unusual.
Post reply on HN