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…
Show HN: HN Avatars in 357 bytes
71–80 of 536 posts
Re: Show HN: HN Avatars in 357 bytes
#72Re: Show HN: HN Avatars in 357 bytes
#73Hah! 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.
Re: Show HN: HN Avatars in 357 bytes
#74Ive been a dev for over 2 decades but I still cant grok bitwise operators - anyone have a reference that may help with that?
Re: Show HN: HN Avatars in 357 bytes
#75How can I try this on mobile?
Re: Show HN: HN Avatars in 357 bytes
#76Re: Show HN: HN Avatars in 357 bytes
#77Hah! 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
#78Re: Show HN: HN Avatars in 357 bytes
#79Re: Show HN: HN Avatars in 357 bytes
#80Posting to see what I got.