Better Code
"if (!event)" or "if (event === null)" are better alternatives.
Aficionados of code profanity in which exasperated operatives embed their disaffection deep in their masters' source code will doubtless enjoy Last.fm's contribution to the genre, found hidden in this innocent-looking page. A quick perusal of the source code reveals: <input id="safariIsWank" type="hidden" value="" /> - an …
Love it. I often embed stuff in my comments which goes unnoticed even though the code is supposed to be reviewed. A former team leader of mine was surprised to find a quite long diatribe in some comments I made about a dodgy hack implemented because I was about to go on three weeks holiday and couldn't be arsed to do it properly (legacy app, being phased out - you know the score). Luckily, he's a mate and foubnd it rather amusing especially as he found it in a section he allegedly reviewed, 3 years after the event.
Curious, I did a search for file:\.js$ f[cu]{2}k firefox on google code search, the result was mainly people complaining about IE, though this searches open source apps and so there would be a tendency to blame the evil Redmondites for everything, quite right too.
Penguin, because I blame the evil Redmondites for most of my daily hassles too.
or is the (relatively non-existent)commenting of that whole piece of code a complete f*cking disgrace.
http://www.koders.com/javascript/fid82A0EBCC891CA06722493DA646BB09267D3E420D.aspx?s=fucking#L177
If i was reviewing that i would have taken one quick glance and sent it back without even checking further. I wouldn't care if it worked or not, it's a maintenance nightmare.
Ahh, I remember the fun times at my old job. I pretty much documented all the bullshit that was going on that particular day - my boss's paycheque bouncing, and him then calling the beancounters and senior management"a bunch of useless tossers" was a frequent occurance.
I used to have conversations with our other devs in comment form. Most of them revolved around which torrents we should choke off the net connection with on that particular day, or which manager/beancounter was giving us the shits.
It was a very hostile workplace - devs + engineers vs senior managers + beancounters - which resulted in all the devs resigning on the same day, racking up a ginormous tab at the pub senior management favourited and leaving them to pay the bill.
Ahh...
I could.
All you need is a desk with your back to a corner where no-one is able to see your screen coupled with administrative control over the infrastructure (proxy server? I bypass your steeeeeenking poxy server).
Don't see the appeal in just *looking* at porn though. It would just eat into valuable commenting on El Reg stories time.
@Stephen Knox: "Okay, here's a hint: for starters, you have to know the difference between 0 and null AND false AND undefined."
Hrmmm... I'm rusty at this, but if I recall correctly--you're reffering to how the value is determined in terms of size and bit order (with the exception of NULL.) 0 is an actual integer, FALSE is a one-bit value, and UNDEFINED could pratically be *any* value/size (which is why you don't find this statement in good code, unless some numpty made it a global constant.)
Only NULL doesn't encapsulate any value/size, as it simply states "there is no defined value assigned to this variable." You can have some pointer remember some random address in memory and it'll return some gibberish based on the size of the variable it's using--it'll never return NULL because there's *always* something there.
@Daniel B.: "Reminds me of that BOOL someone posted in the Daily WTF"
Shouldn't it be "enum BOOL {FALSE, TRUE, NOT_TRUE_OR_FALSE }; based on bit order?
But, then again, this is a moot point; it's basically adding an actual '2' to raw binary '01' code. (Enums also don't take constants very well, as it's bad coding pratice to do so.)