Skip to main content

pm2 Quick Start

I couldn't find a single consolidated place that explains how to setup pm2 from scratch (assuming you've already installed Node.js), and their own "quick start" didn't help. I was finally able to piece together how to get it working.

Iframe Garbage Collection

When you have an iframe loading an intense amount of content (like an entire video game, in the case of https://playfeed.io), and you need you need to reuse that iframe, you need to force the iframe to free up its memory usage so the browser will garbage collect it.

Nginx HTTPS from scratch

A simple step-by-step guide to setup Nginx with HTTPS from scratch. This was originally performed on a Raspberry Pi but should work fine on any Debian-based Linux (like Ubuntu). Keep in mind that I'm still a noob at this, so this guide might not result in the best configuration but at least it works!

Use Touch ID for sudo on macOS

Add the line

auth       sufficient     pam_tid.so

at the top of /etc/pam.d/sudo (you will need sudo access to write to that file).

You'll need to do this after at least every OS update as that file gets overwritten in those updates.

Here's a single command you can run to accomplish this:

sudo sed -i '' '2i\
auth sufficient pam_tid.so
' /etc/pam.d/sudo

Frontend Bundling

Frontend bundling is a process by which your frontend source code, typically spread across multiple files, gets squished and transformed into few files, often just one file. This post will cover some basics around bundling.

ESM vs CJS

There are currently two main module formats in the JavaScript ecosystem: ECMAScript Modules (ESM) and CommonJS (CJS). CJS was first, but ESM is now the JavaScript standard and is the future. The main difference between the two is how they import files.

Preventing Ridiculous ESLint auto-fixes in VS code

I recently adopted ESLint into my workflow and enabled fix-on-save in VS Code. I've noticed since then that sometimes massive chunks of code get deleted on save by the fixes. My current suspicion is that this is entirely to blame on the rule @typescript-eslint/no-unused-expressions. I've noticed other auto-fix issues as well, however, and will track down the culprit rules as they occur.

It is possible to leave fix-on-save enabled yet disable only the bad rules! Below is the JSON config that you will need to insert in your VS Code settings to do that. As I discover more problematic rules in the future, I'll append them below.

"eslint.codeActionsOnSave.rules": [
"!@typescript-eslint/no-unused-expressions",
"*"
],