Alex MacArthur
@macarthur.me
📤 30
📥 21
📝 104
Bossing around computers in made-up languages.
He’s right. This place will continue to lose if it keeps operating like this.
add a skeleton here at some point
3 months ago
0
0
0
I have learned first-hand that the document.currentScript can be useful.
#javascript
macarthur.me/posts/curren...
loading . . .
`document.currentScript` is more useful than I thought.
After discovering and being unsure of its value, I just realized how useful `document.currentScript` can be in exposing configuration properties to `<script>` elements (and other things too).
https://macarthur.me/posts/current-script
4 months ago
0
2
0
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...
loading . . .
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.
https://macarthur.me/posts/generators
5 months ago
0
4
1
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.
6 months ago
1
0
0
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...
loading . . .
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.
https://macarthur.me/posts/forbidden-request-headers
6 months ago
0
0
0
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.
8 months ago
0
0
0
TIL about “forbidden” request headers. None of these can be set in the browser by JavaScript APIs like fetch() or XMLHttpRequest.
8 months ago
0
2
1
reposted by
Alex MacArthur
Barry Pollard
8 months ago
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:
1
13
4
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:
8 months ago
1
3
1
Look at what you'll soon be able to do in native CSS (currently supported in Chromium browsers):
8 months ago
1
1
0
Short post about composing template literal types in TypeScript:
macarthur.me/posts/templa...
loading . . .
I didn't know you could compose template literal types in TypeScript.
TypeScript's string literal types are a lot more useful than I originally thought.
https://macarthur.me/posts/template-literal-types
8 months ago
0
2
1
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...
loading . . .
Short-Lived, Tick-Bound Memoization in JavaScript
Sometimes, typical memoization function won't cut it when there are so many changing variables in play between ticks of the event loop. Let's explore how we might fine-tune it.
https://macarthur.me/posts/memoization
9 months ago
0
2
0
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
loading . . .
Using Forced Reflows, the Event Loop, and the Repaint Cycle to Slide Open a Box
Triggering smooth, reliable CSS transitions with JavaScript can be weirdly more complicated than you expect. We're gonna explore it more.
https://macarthur.me/posts/box/
9 months ago
0
1
0
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.” 🤦‍♂️
10 months ago
0
1
0
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
loading . . .
You Might As Well Use a Content Security Policy
Content Security Policies, even for simple, content-focused sites, offer good protection against rare but real vulnerabilities out there. You might as well just get one.
https://macarthur.me/posts/csp
10 months ago
0
0
0
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.
10 months ago
0
0
0
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
10 months ago
0
1
0
My daughters are starting their first entrepreneurial endeavor. Introducing the Bin Buddies!
binbuddies.pro
loading . . .
Let the Bin Buddies roll out your bins for you!
We'll take out your trash & recycling bins for you every week, so you don't have to keep forgetting about it!
https://binbuddies.pro
10 months ago
0
0
0
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...
loading . . .
Vanilla JavaScript
https://jamcomments.com/docs/integrations/javascript
10 months ago
0
0
0
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. 🥷
loading . . .
JamComments: A guilt-free comment service for your blog.
A blog comment service and Disqus alternative that won't leave you feeling like you missed a shower.
https://JamComments.com
10 months ago
0
0
0
Crazy how we’ve all just forgotten about the fact that there’s a map on the back of the Declaration of Independence.
10 months ago
0
1
0
What a friggin week. Never touching a database again.
10 months ago
0
1
0
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...
loading . . .
Avoiding a "Host Permission" Review Delay When Publishing a Chrome Extension
Get a Chrome extension reviewed a smidge more quickly by more carefully executing its client-side scripts only when they're needed.
https://picperf.io/posts/chrome-extension-host-permission
10 months ago
0
0
0
Of course.
10 months ago
0
0
0
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.
10 months ago
1
0
0
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...
loading . . .
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.
https://picperf.io/posts/collect-images-with-puppeteer
11 months ago
0
0
0
Jira tickets: Pagan: “As a user,” Saintly: “As a child of the Living God,”
11 months ago
0
0
0
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-...
loading . . .
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.
https://macarthur.me/posts/safer-dangerouslysetinnerhtml/
11 months ago
0
4
1
macarthur.me/scraps/footp...
loading . . .
Unseen Footprints
Sometimes I feel like I’ve been holding my breath for a long time and I'm not sure there will be any air to breathe when I finally let go. It’d be nice to know what God is doing in those moments rathe...
https://macarthur.me/scraps/footprints
11 months ago
0
1
0
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
loading . . .
AI will not write for me.
Why I've committed to never allowing AI to articulate an idea on my behalf.
https://macarthur.me/ai
11 months ago
0
0
0
ChatGPT is the 4th most largest referrer to TypeIt’s site right now. Kinda crazy.
11 months ago
0
0
0
Quick demo on using TypeIt and React to create a text streaming animation like ChatGPT:
macarthur.me/posts/stream...
loading . . .
Streaming Text Like an LLM with TypeIt (and React)
We're getting real familiar with seeing LLMs stream chunks of text to a page. Here's a simple demonstration of how you'd mimic the effect with TypeIt.
https://macarthur.me/posts/streaming-text-with-typeit
11 months ago
0
0
0
macarthur.me/scraps/control
loading . . .
Control
It is pathetic how often I overestimate the control I have over my circumstances, and how protective I am of the little I do have. A couple passages have been stirring this up. First, from Exodus. The...
https://macarthur.me/scraps/control
11 months ago
0
0
0
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
11 months ago
0
0
0
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...
loading . . .
I didn't know you could use sibling parameters as default values in functions.
Default parameter values have been in JavaScript for a while. But I just found out you can use sibling parameters as the default values themselves.
https://macarthur.me/posts/sibling-parameters/
12 months ago
0
0
0
macarthur.me/scraps/whirl...
loading . . .
Whirlwind
I’ve either never seen this verse or I’m reading it with different eyes: “Though he slay me, I will hope in him; yet I will argue my ways to his face.” - Job‬ â€13‬: â€15‬ â€ESV‬‬What a weird combination...
https://macarthur.me/scraps/whirlwind/
about 1 year ago
0
0
0
macarthur.me/scraps/being...
loading . . .
Being Still
I have not been reading Psalm 46: 10 correctly for a long time (probably because I’ve always read it in isolation). “Be still, and know that I am God.”I’ve always taken “stillness” to strictly be a sy...
https://macarthur.me/scraps/being-still
about 1 year ago
0
0
0
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...
loading . . .
It Might Be Worth Converting that GIF to an Animated WebP
The animated GIF has become a key piece of today’s meme culture, despite being around decades prior. But there are serious technical advantages to
https://picperf.io/posts/gif-to-webp
about 1 year ago
0
0
0
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.
about 1 year ago
0
0
0
PicPerf’s over here converting 8,000px-wide images to AVIF without whining about it. Such a diligent little workhorse.
about 1 year ago
0
0
0
Wrote a blog post on native JavaScript decorators for Frontend Masters. Read it!
frontendmasters.com/blog/explori...
loading . . .
Exploring the Possibilities of Native JavaScript Decorators – Frontend Masters Boost
Native support for decorators is inevitable! It simplifies augmenting class methods, which can help with things like logging, memoization, debouncing, and dependency injection.
https://frontendmasters.com/blog/exploring-the-possibilities-of-native-javascript-decorators/
about 1 year ago
0
0
0
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...
loading . . .
GitHub - alexmacarthur/power-plant: A dependency injection framework built on native decorators.
A dependency injection framework built on native decorators. - alexmacarthur/power-plant
https://github.com/alexmacarthur/power-plant
about 1 year ago
0
0
0
Check this out - an IoC container/dependency injection framework using native JavaScript decorators in 25 lines of code.
about 1 year ago
0
0
0
Self-hosting Plausible Analytics without automated backups can keep you up at night, and it is a well-established fact that poor sleep may lead to you dying. To help, I wrote this guide on setting them up with an S3/R2 bucket and a little cron job:
plausiblebootstrapper.com/posts/back-u...
loading . . .
How to Back Up Self-Hosted Plausible Analytics Data to an R2 or S3 Bucket
Services like S3 and R2 can be invaluable when self-hosting Plausible Analytics. Let's walk through what it looks like to use them for automated backups a simple cron job.
https://plausiblebootstrapper.com/posts/back-up-plausible-to-bucket
about 1 year ago
0
0
0
I wrote a short post on using client-side JavaScript to built structured data.
macarthur.me/posts/struct...
loading . . .
On Building Structured Data with Client-Side JavaScript
Thinking through some of the trade-offs and benefits in using client-side JavaScript to generate structured data.
https://macarthur.me/posts/structured-data-with-javascript/
about 1 year ago
1
1
0
A small
JamComments.com
update has been rolled out to all integrations. You can now customize many of the bits of microcopy throughout the UI, rather than going w/ the standard, out-of-the-box stuff. To help you picture this concept, I made you this picture.
about 1 year ago
0
1
0
You can now retrieve all your comments from JamComments via REST API. 🎉 Should allow you to get pretty creative in how you surface them across your site.
#jamstack
jamcomments.com/docs/api
loading . . .
The REST API
The REST API allows you to fetch comments as a paginated JSON list.
https://jamcomments.com/docs/api/
about 1 year ago
0
0
0
Serneke Bostad - a Swedish homebuilding company - is using PicPerf to optimize over 2,700 images. Average size reduction: ~94%. 🤯
#webperf
#seo
#performance
about 1 year ago
0
0
0
Wrote a wittle blog post on adding structured data to your Astro Starlight documentation site.
#seo
jamcomments.com/posts/struct...
loading . . .
Adding Structured Data in Astro's Starlight Documentation Framework
Astro's Starlight documentation theme is great, but currently lacks support for building structured data (JSON-LD). Fortunately, it's easy enough to roll yourself by overriding a component.
https://jamcomments.com/posts/structured-data-with-starlight
over 1 year ago
0
1
0
JamComments.com
now supports *two* approaches to auto-generating JSON-LD structured data: 1. Client-side rendered On page load, comment JSON is grafted into the existing “BlogPosting” or “Article” entity on the page via JavaScript.
over 1 year ago
1
1
0
Load more
feeds!
log in