Live data from Hacker News

Show HN: HN Avatars in 357 bytes

news.ycombinator.com

91–100 of 536 posts

Re: Show HN: HN Avatars in 357 bytes

#94

Earlier quoted context omitted.

Point of information: the ;void(0); isn’t necessary here because the code ends in a for loop, which produces undefined. (For anyone who doesn’t know about the meaning of void in JavaScript: it’s a unary operator that ignores its operand and produces undefined . What is commonly spelled `void(0)` is briefer as `void 0`. Why don’t people just write `undefined`? For some, because it’s shorter, but mostly for historical…

It wasn't actually working for me; it was returning 0 actually. But yeah, this is a good point as well. :D

Huh, turns out my understanding of how it worked was wrong: in things like for loops, it takes the last value encountered. I should have anticipated that, really, given that “last expression” isn’t generally a thing in JavaScript anyway (it’s statement-oriented, not expression-oriented), so javascript: URIs (and I guess on* event handler attributes too, I know they’re a bit weird too) were clearly doing something clever and not-usual-JavaScript. I should delve into specs until I can find it; it seems like it’s at least mildly expression-oriented in character.

I retract the first paragraph of my earlier comment with an apology.

Re: Show HN: HN Avatars in 357 bytes

#99

An unkown person asks you to inject code in your browser. Sorry folks, but this should be a red flag for all of you. I guess you all know enough about obfuscation to know that what you think the code does is not always what the code does. "But it has upvotes!" For all you know, the script could upvote this post.

It is very short and quite easy to see that it is safe, even if you do not fully grok what is going to happen. If you don't, then by all means do not run it.

Re: Show HN: HN Avatars in 357 bytes

#100
post #77

Earlier quoted context omitted.

It should be fairly straightforward to turn this into a browser addon, give users a choice and offload the people behind HN.

Or even easier to make a userscript: https://openuserjs.org/

What is a user script?
Post reply on HN