Alex MacArthur

Alex MacArthur

@macarthur.me

Bossing around computers in made-up languages.

29 followers21 following106 posts

He’s right. This place will continue to lose if it keeps operating like this.

Brett Meiselas@bmeiselas.bsky.social

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

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

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.

- Each image will be measured, using the rendered & natural widths to determine if it could be resized more effectively. - Eligible images will be asynchronously resized based on how they *actually* show on a large screen.

- The lighter, resized images will be served for future page views. I've seen many, many examples of 3000px-wide images being used for a small 300px-wide card. Now you don't even need to think about it. Just plop a small, deferred, non-intrusive script pages with PP images. ⚡️

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

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

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:

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

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.

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

picperf.ioCollect All Requested Images on a Website Using PuppeteerWalking through how I used Puppeteer to programmatically collect every image loaded when a page is viewed in the browser.

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

macarthur.meMake dangerouslySetInnerHTML Safer by Disabling Inline Event HandlersEven 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.

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

AI-powered moderation in JamComments is a go! Rather than auto-approving everything (risky), or manually doing it yourself (a hassle), set a prompt and an LLM (or a small man in a box - who knows) will handle it. Real easy to set up.