Live data from Hacker News

Show HN: HN Avatars in 357 bytes

news.ycombinator.com

71–80 of 536 posts

Re: Show HN: HN Avatars in 357 bytes

#71
post #70
post #43

This is fun. One suggestion.. rather than creating a canvas for each user using a querySelectorAll and a loop, I'd use an IntersectionObserver and only create the canvases as they scroll into view. That way the user's device won't need to create hundreds of elements when the code runs. let observer = new IntersectionObserver( (entries) => { entries.forEach((entry, i) => { if (entry.isIntersecting) { const p = 2; cons…

Speaking performance/optimisations, interesting choice to destroy canvas when it leaves viewport and recreate it upon each re-entry. Personally I'd leave it created and stop observing the element instead, à la /* … */ if (entry.isIntersecting) { observer.unobserve(entry.target); /* … */ } Do you think (or know) that swapping observed node for canvas (potentially producing many canvases) is more expensive than keeping…

That's a really good idea. Definitely something to measure, but I suspect you're right.

Re: Show HN: HN Avatars in 357 bytes

#73

Hah! I got a really cool little icon that looks almost like the cassette tape pirate logo of Piratbyrån back in the day. I have old t-shirts with that logo. MAKE. THIS. PERMANENT! On the functional side, this really helps you see who is who in a long threaded discussion. Your eye is much quicker at following the little color icons than their names.

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

Re: Show HN: HN Avatars in 357 bytes

#74

Ive been a dev for over 2 decades but I still cant grok bitwise operators - anyone have a reference that may help with that?

It helps if you look into bits and binary arithmetic; I learned it from the appendix of my school book Structured Computer Organization. Binary and binary arithmetic is probably the best place to start.

Re: Show HN: HN Avatars in 357 bytes

#77

Hah! I got a really cool little icon that looks almost like the cassette tape pirate logo of Piratbyrån back in the day. I have old t-shirts with that logo. MAKE. THIS. PERMANENT! On the functional side, this really helps you see who is who in a long threaded discussion. Your eye is much quicker at following the little color icons than their names.

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/
Post reply on HN