Writing

Here you’ll find some bloggin’ about business, design, and web development. And also whatever else I want to write about. Read on! (Or don’t. I think you’re cool either way.)

Reviving an old printer with CUPS and Caddy

I just recently upgraded to an M2 Mac. I needed to print something not long after I set my new computer up, and — surprise! — our old Canon Pixma MX410 doesn’t work on the Mac anymore.

Canon has stopped supporting this printer entirely, and I guess Apple culled the printer’s driver from the kernel at some point. There was no Mac ARM version of the driver that I could find.

But all is not lost! Using CUPS and Linux, now I can print with my old printer from my new Mac — or even my iPhone or iPad. Here’s how I was able to turn my Raspberry Pi into a print server, and saved myself the trouble and expense of getting a new printer.

Stop Dropbox syncing node_modules with `find` and Hammerspoon

I’ve been a Dropbox customer for basically a decade. They’ve never lost my data! It’s been a good service, despite their growth and the frustration of dealing with their ever-noisier (and nosier) desktop client.

However, my main frustration with Dropbox is that there’s no way to tell it to ignore any file or folder that matches a particular pattern.

How to tell if an app is scriptable via AppleScript

Open Script Editor. Click Window > Library (or press ⌘+⇧+L). Click the + sign on the upper left. Choose an application and click “Open”. If the app is scriptable, it should have a library that you can add to this list. Otherwise, it’ll tell you you can’t script it! If you can add the app … Continued

Self-hosting an automation platform for free

Do you ever need to run simple automations for personal projects? What do you use? Zapier is terrific. It’s powerful and it provides a generous free tier. But when you need something more complex than simple if-then logic, like “send me an email when this event happens, but only if the event data contains an … Continued

Hold ON a minute

Let’s say you’re testing a function that: Does not accept callbacks (so you can’t use done as described previously) Is not async and doesn’t return a Promise Does not fire events or otherwise notify the outside world that something happened Does behave asynchronously, by e.g. calling external APIs or waiting on internal events Further, let’s … Continued

Testing async code in Jest

I’m in the process of learning Jest and doing my first TDD in Javascript. It’s hard! Jest is tough, even though it’s supposed to make JS testing a bit easier. Testing async code (literally, code that uses the async keyword), in particular, is tricky, especially when you have non-obvious calls to async functions.

New Skillshare class

Skillshare approached me recently to create a new class, after having seen my work on Codepen. They’re expanding their tech catalog pretty rapidly, so I’m sure I’m not the only developer they’ve contacted — but I still took it as a huge compliment. When we brainstormed ideas, Jessica from Skillshare suggested that, since my background … Continued

Modern JS in Legacy Projects, Part Three

Part one of this series discussed the why; part two introduced our “legacy” application and got its basic functionality hammered out with surprisingly little hoopla; now we can add a little somethin’ extra to make it magical. ✨

Our latest deploy is missing some key features that were part of the spec:

  • The “Reset” button doesn’t work, and
  • We’re not saving the state of the modal anywhere locally so that it persists across page reloads.

So in Part Two, I lied: we’re not turning this guy into a component just yet! Let’s knock out the rest of our basic functionality first.

Modern JS in legacy projects, part two

This is the second part in a series on modernizing your JavaScript incrementally, using Vue.js. Part one discusses why we might need to do this.


Shall we review?

  • Pretend you have an old project that’s built with jQuery
  • Your client’s needs have changed, and now they need advanced functionality that would be difficult to build with vanilla JavaScript and jQuery
  • You decide to build the new functionality with Vue.js, ’cause it seems good

Our project will end up with some fancy functionality for surprisingly little trouble. But we’re not there yet! Let’s write some code.

Adding modern JavaScript to legacy projects

Here’s a question for ya:

Do you need to be working with a blank slate to adopt a new front-end framework like React or Vue?

Many of the resources you’ll find about these technologies are written with the assumption that you’re starting a brand new project. While that’s helpful when you have the opportunity to start a project from scratch, the reality for most teams is a bit more complicated.

Here’s the reality for most of us:

  • We have lots of old projects sitting around with aging jQuery scripts that handle form submissions, sliders, YouTube videos, etc.
  • We want to learn new technologies and best practices, but our existing projects still need maintenance and new features
  • It’s not really practical to revamp our existing toolchains/build processes on these old projects for the sake of modern JS
  • Our customers’ needs and priorities change as our projects age, which sometimes means developing new features and functionality quickly

In that context, does it make sense to add modern frameworks to old projects, or should we just pile a few more noodles onto that delicious, delicious jQuery spaghetti? (Everybody does it, DON’T YOU ACT LIKE YOU DON’T. 🍝)

This is a question that only you can answer, as your users’ and clients’ needs are totally unique. But I’d argue that in some circumstances, it makes perfect sense to introduce a new framework like React or Vue, or any of the other super hip frameworks du jour, to an old project.

In fact, once you learn some basics, frameworks can help you get more work done at higher level of quality than if you’d piled on yet another jQuery plugin. (Side note: If we write jQuery spaghetti, what does that make jQuery plug-ins? jQuery meatballs? ¯\_(ツ)_/¯)

It might make sense to add a new framework into the mix as soon as your client requests any functionality that involves lots of state.

So how can we add new functionality based on new frameworks without breaking existing code, or otherwise making a mess of things?