Justin Duke

Migrating from moment to date-fns

I got a lot of positive feedback from my recent article on how I cut my webpack bundle size in half, and a common refrain was how folks found themselves in the same position as I did in terms of deciding to migrate off of moment.js.

A handful of folks suggested date-fns as an alternative. date-fns has a relatively clumsy name but offered excatly what I was looking for:

  • Modularity and tree-shaking compatability.
  • Use of native dates
  • TypeScript support

So I decided to take the plunge and try migrating: the surface area of my use of moment wasn’t that large, so I hoped it would be relatively painless.

(Spoiler alert: it was.)

Read more →

A month with the AirPods

I bought them, you see, despite my better instincts.

I already had BlueTooth earphones that worked (albeit not well).

I already had a pair of Bose over-the-ears that are perfect for day-to-day work and for noisy situations, like planes and crowded coffeeshops.

And my army of EarPods (or, perhaps, EarPods knockoffs — I purchased five of them for like $50, with the understanding that I’d lose or break a pair every month or so) was still fine, though its ranks were slowly dwindling.

But I’d been seeing more and more AirPods in the wild, and decided to get a pair.

Read more →

How I cut my Webpack bundle size in half

In the fall, a young man’s fancy lightly turns to thoughts of front-end performance.

When I initially built out Buttondown, I was focused on two aspects above all else:

  1. It being built quickly.
  2. It working reasonably well.

Notably excluded from that list is performance. Buttondown isn’t a slow app, but it is a heavy one: the bundle size while developing is measured in megabytes, and there’s a non-trivial loading time for first-time users.

Now that the core feature base has stabilized and nothing is particularly in an “on fire” state, I wanted to turn my eye towards maintenance work, and a big piece of that was seeing what I could do to shrink that bundle.

Read more →

Not The Keynote You're Looking For

I hate to be in the position of defending Apple evangelists, but there have been a lot of weird takes about the Apple leaks the past few days. Here’s one:

I think the comparison between Star Wars and Apple products is particularly apt because, well, Star Wars isn’t “commercial art”: it’s a meticulously managed piece of intellectual property. It isn’t a singular artistic vision: its the culmination of hundreds of stakeholders, producers, focus testers, and marketers. So much so that the director of a Star Wars movie just got replaced, like a poorly-performing engineering manager:

Read more →

Turning 25

This week, I turned 25.

I spent my birthday doing the thing I want to spend every birthday doing: I reverse seared a filet, bought a nice scotch, and watched an old movie with Molly.

We were going to watch Bridge on the River Kwoi but didn’t want to start a three-hour movie at eight pm, so we watched The African Queen.

We have become so old. It is fantastic.

Read more →

Creating a password validator component in Vue

Sometimes you procrastinate one feature by writing another. Even if that other feature is pretty small and inconsequential. 1

For me, that other feature — if you can even call it a feature — was password strength testing for Buttondown.

This is one of those things that I always liked on other sites, but didn’t really know how to implement myself!

Read more →

There are still dragons everywhere

I’ve been programming for the better part of a decade, and I’ve been programming in Python for the better part of that better part.

As loathe as I am to assume the mantel of “X Engineer”, if I were to describe my career in relation to any technology it would be “Python Engineer”.

It is the language I feel most comfortable with; it is the language I reach to first when starting a new project; it is the language I write daily. It is as frictionless as English.

And yet I still find myself losing hours to things I thought I had mastered.

Read more →