Category: Software Development
-
Client-side environment variables with Next.js
Next.js does a great job with environment variables. Out of the box, it supports loading up environment variables in next.config.js as well as using a .env file. Both of which are made available inside of server components. For client-side components though, you don’t get direct access to environment variables from both locations. The Next.js config…
-
Including Dev Dependencies in a DigitalOcean App Platform Build
When working with dependencies in a DigitalOcean App Platform build, there are time when you may need to include development dependencies. Such instances arise when you’re using something like TypeScript, which you’d typically have listed in your devDependencies because it’s not a necessary dependency once you’ve transpiled your code and shipped it to production. Out…
-
How to Delete from a Table with Foreign Key Constraints in MySQL
I hate foreign keys. They are rarely implemented properly, often times failing to implement cascading deletes and updates. Sure, the concept is sound, and relationships are the first letter in RDBMS, I personally avoid using foreign keys as I find the potential for orphaned data to be way more manageable. While I don’t use foreign…
-
Convert string to number with JavaScript
Been working through swapping a MySQL library recently to prepare for a major database upgrade. The old library would return the results from function like AVG and SUM as a number. The new library, not so much. MySQL natively returns those values as strings, which I can applaud the library for respecting. Coming from a…
-
How to Make Your WordPress RSS Feed Show Full Articles Instantly
Finally getting around to resurrecting my newsletter, I wanted to update my RSS feed to include the full text of my articles, so that the entire post will be included in the email. Fortunately, WordPress has an option for this, and it doesn’t even require a plugin to pull it off. Enable full text in…
-
Fix broken Docker networking in GitLab Runner pipeline
Out of the blue this past week, networking between my Docker containers running in my GitLab CI/CD pipeline stopped working. I bet you’re thinking that I pushed some new code and it broke, and I decided to take the low road and blame my tech stack? Absolutely not. After an issue years ago that bit…
-
Numeronym in JavaScript
Numeronyms are a form of abbreviation. The middle of the word or phrase is swapped out for a number that represents the number of letters that are being replaced. The first and last letters are retained. Some examples are: I’m not really a fan of the word “numeronym”, primarily because I can’t ever seem to…
-
Stop ESLint from searching up the directory tree
For most projects, I use a monorepo, and nest my scripts in a directory. I’ll npm init each script, and maintain an isolated set of dependencies outside of the main dependency tree. This includes maintaining a separate .eslintrc file as well. Typically, this isn’t a problem, but recently with a new project that was created…
-
Airbnb style guide with Next.js
Starting a fresh Next.js project the other day, I was happy to see that configuring eslint was part of the bootstrapping process. Where things fell short for me, was the lack of a prompt asking me which style guide I’d like to use. I’m sure the out of the box option is sufficient enough, and…
-
Mocha tests hang after tests have finished
Recently, while revisiting a Node.js repository I haven’t contributed to in ages, I encountered a new problem: the Mocha tests would hang instead of exiting. When I asked about the error, it seems it was recently introduced and nobody had pursued tracking down the root cause of the issue. Conveniently, this issue was only happening…