Alex MacArthur

@macarthur.me

Bossing around computers in made-up languages.

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 think the ergonomics of generators is growing on me.

I took a stab at getting more familiar with iterators, iterables, and generators. I think I'm starting to like the ergonomics.

macarthur.me

Sickkk new feature coming to PicPerf: automatic resizing. Here's how it'll work: - Behind the scenes, PP will headlessly render your page at a large desktop's screen dimensions.

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...

I guess some request headers are more trustworthy than others.

There's a subset of request headers that can't be modified by a spec-compliant user agent. Let's explore why they're useful for determining how and for what purpose a request was triggered.

macarthur.me

I think we’re over-indexing on the importance of time-to-ship and the AI tooling that minimizes it. Shipping is easier, but committing to iterating on & growing a product is still hard. That’ll probably continue to be the differentiating factor between success & failure.

If you’ve ever needed to break up a long JavaScript task to keep the UI responsive, you’ve probably reached for setTimeout(). Turns out there are a boatload of other options at your disposal, like scheduler.yield(). I wrote about a handful & their tradeoffs:

scheduler.yield() example

Comment submissions for JamComments just got a big speed boost because I finally remembered to set Laravel’s QUEUE_CONNECTION to something other than “sync.” 🤦‍♂️

My first (personal) M series MacBook is coming this week. I’ve been doing all dev work on a 2015 MBP until now and I’m so ready to enter the future.

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

Bild

Early version of the PicPerf Image Saver extension is out. Plz try it! It lets you download any WebP or AVIF as a more useful JPEG, PNG, or GIF. Got it submitted to the Chrome Web Store, but you can install the unpacked version now.

Bild

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...

Collect All Requested Images on a Website Using Puppeteer

Walking through how I used Puppeteer to programmatically collect every image loaded when a page is viewed in the browser.

picperf.io

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-...

Make dangerouslySetInnerHTML Safer by Disabling Inline Event Handlers

Even though it won't run <script> tags, React's dangerouslySetInnerHTML still allows inline event handlers to execute. Here's how you might neutralize that threat.

macarthur.me