Live data from Hacker News

Show HN: HN Avatars in 357 bytes

news.ycombinator.com

481–490 of 536 posts

Re: Show HN: HN Avatars in 357 bytes

#486
post #291

Earlier quoted context omitted.

It's a good point, I did consider using that feature but the problem is it's not very cross browser friendly, so I stuck with simpler DIY pixel scaling. In fairness I think there is basically two different values for chrome and firefox, although I'm not sure about safari and cannot test it...

Firefox shipped the value "pixelated" five months ago, so you don’t need to worry about a "crisp-edges" fallback any more. Safari, back in 2016. https://caniuse.com/css-crisp-edges This is valuable for high-DPI and zoomed pages, to avoid bilinear or similar scaling; the matter of halving the canvas size was a red herring.

Ah, good to know it's finally normalised.

Re: Show HN: HN Avatars in 357 bytes

#487
post #8
post #2

This was inspired by @frncsdrk's submission from earlier today [0]. The generative concepts used were inspired by and derived from dweets from @KilledByAPixel and @FireFly [1] [2] [3] The concept is to use HN usernames as the seed into a deterministic avatar generator. This generator is built from the famously simple xorshift32 PRNG, which both provides a random variable for the image generator steps, and "pseudo-has…

There's actually a slight difference between the golfed and un-golfed version: the un-golfed adds the avatar to the beginning of the line with the username, whereas the golfed version adds it right next to the username. I actually find it to be more visually appealing at the beginning of the line, so I'm sticking with that in my Greasemonkey script. To anyone interested, I've added links to how the un-golfed version…

Yup, i noticed an opportunity to make it smaller while golfing.

There is one advantage of the golfed version, which is that it will also inject avatars wherever it finds the .hnuser class, including on other pages.

Post reply on HN