In the midst of JamComments updates, I had the chance to experiment with a number of ways to preload images in JavaScript. Wrote 'em up here: macarthur.me/posts/preloa...
Alex MacArthur
Alex MacArthur
@macarthur.me
Bossing around computers in made-up languages.
29 followers21 following106 posts
I wrote about DNS resolution from the POV of a browser, and how you can fine-tune the process to squeeze out some performance points. Check it: macarthur.me/posts/dns/
He’s right. This place will continue to lose if it keeps operating like this.
JD Vance just made an account on here and then was swiftly banned. I am obviously no fan of the VP, but Bluesky will never experience the growth it needs if it instantly bans any dissenting voice, including the Vice President of the United States. Feels like the wrong way to run things IMO.
I have learned first-hand that the document.currentScript can be useful. #javascript macarthur.me/posts/curren...
I’ve been spending some dedicated time tinkering w/ iterators, iterables, & generators in #JavaScript. I’m still struggling a bit to find use cases in which it’s materially the best solution. But! I am liking the ergonomics more. Blog post: macarthur.me/posts/genera...
I learned about “forbidden” request headers recently, which can’t be overridden by client-side JavaScript APIs. A subset also give some nice context about a request, like whether it came from someone directly navigating to a page. Useful stuff. Wrote more here: macarthur.me/posts/forbid...
Alex MacArthur reposted
Good post from @macarthur.me on the various ways to break up long tasks. macarthur.me/posts/long-t... I especially like nice summary at the bottom:
Wrote about it more detail here: macarthur.me/posts/modern...
Short post about composing template literal types in TypeScript: macarthur.me/posts/templa...
I wrote about using short-lived memoization bound to a single tick of the event loop in JavaScript. queueMicrotask() is awesome. Read: macarthur.me/posts/memoiz...
I blabbed a ton about forced DOM reflows, the event loop, and the browser’s repaint cycle, just to slide open a box with CSS transitions & JavaScript. Look: macarthur.me/posts/box
I’ve been learning about content security policies and have reached the following conclusion: They’re valuable even for simple blogs and very easy to set up. You should probably just get one. macarthur.me/posts/csp
Simple demo for embedding JamComments client-side: - ~10 lines of code to configure - no custom styles necessary - ~2.6kb (gzipped) of JavaScript needed to load - ~3.6kb of HTML to load lazily load in after that And none of the grossness other comment tools throw in. jamcomments.com/demo/vanilla
My daughters are starting their first entrepreneurial endeavor. Introducing the Bin Buddies! binbuddies.pro
You can now embed comments on your website entirely client-side. Very similar to how some other services work, but with a waaaaaaaaaay smaller performance penalty and far less grossness. jamcomments.com/docs/integra...
JamComments.com is about to become very CSP-friendly. And as a result, it’ll be very difficult to tell you’re using a third-party service, even by looking through the page source. 🥷
Small blog post on running a Chrome extension's content scripts in a way that won't cause a review delay: picperf.io/posts/chrome...
I’m proud of how PicPerf’s page analyzer is built. It uses Bun, Puppeteer, and Laravel to collect *only* the images that’d be downloaded when a user scrolls down a page on a phone, before running an optimization analysis on each one. Wrote about wiring it up: picperf.io/posts/collec...
Found out a few weeks ago that React's `dangerouslySetInnerHTML` prop is more dangerous than I thought — inline event handlers on injected HTML still fire! Easy enough to neutralize, though. A short post about it. #javascript #reactjs macarthur.me/posts/safer-...
I've published a first version of my policy on AI for my website. It's likely shift a bit over time, but I don't see the spirit of it ever changing. macarthur.me/ai
Quick demo on using TypeIt and React to create a text streaming animation like ChatGPT: macarthur.me/posts/stream...
Introduced domain settings for PicPerf.io. To start, you can set a max image width for optimizations. No more worrying about accidentally making your visitors download a hero image 5k pixels wide (more common than you might think!). #webperf
Didn’t know until recently that you could use adjacent parameters as default values in functions & classes in JavaScript. Post about it: macarthur.me/posts/siblin...
It's in your best interest to use animated WebPs instead of GIFs on your website. More words about it: picperf.io/posts/gif-to...
Wrote a blog post on native JavaScript decorators for Frontend Masters. Read it! frontendmasters.com/blog/explori...
I've been tinkering with native JavaScript decorators for the past few weeks, and became obsessed with one use case: dependency injection. In all that tinkering, I ended up building a small framework around it. Here’s Power Plant: github.com/alexmacarthu...