Chris
Multi-Stage Docker Build Arg Example
Today I needed access to an environment variable whilst building a Docker image from a Dockerfile. To make the example concrete, I wanted to get access to the Git commit hash exposed in a CircleCI build. The idea was to then use this commit hash inside my build as a cache buster on client side … Read more
Post Redirect Get Pattern Example
In this post we are going to cover the Post Redirect Get pattern using NodeJS, Express, TypeScript, and for rendering things, Nunjucks and the Gov UK front end. This pattern is generic to any MVC implementation, and the concepts are very easily adapted. The Post Redirect Get pattern is for handling form submissions in web … Read more
How To Hide Console Logs In Jest
There’s something super irritating to me about seeing a Jest test suite run and a bunch of noisy console logs get dumped out, mucking up the results. Here’s an example: At a glance, I find it’s pretty hard to know which of those tests is problematic. Even with the coloured console output, the big expected … Read more
Advent of Code 2023: Day 1 Part 2 – Fixes Required
This post follows on from Advent of Code 2023: Day 1 Part 1 – Calibrating Snow Operations where we were busy solving the Advent of Code 2023 Day 1 exercises using Kotlin and TDD. Part 1 is solved, but as soon as you provide the answer, Part 2 becomes available. Mean. The problem is similar, … Read more
Advent of Code 2023: Day 1 Part 1 – Calibrating Snow Operations
I’ve never yet taken part in the Advent of Code, and judging by how much time it took me to solve both parts of Day 1, it’s debatable as to whether I will have completed all challenges by Christmas Eve. But it’s an excuse to test out my rather rudimentary Kotlin skills, and share what … Read more
TypeScript Type Guard Example
I was reviewing some TypeScript code this afternoon that had a type assertion (as) (also commonly called a ‘cast’) in there that could have been avoided by using a Type Guard. Type Guards are one of my favourite features of TypeScript. That makes me sound like a real nerd. But hey, I might convince you … Read more
Create A Postman Request From cURL
A really simple one today, but one I had need of, and wasn’t sure was possible. That is to take a cURL request and import it in to Postman. The clue is in italics above. However, I didn’t know this feature existed, and judging by the replies I got internally on Slack, neither did anyone … Read more
How I Fixed: (WARN) Define ts-jest config under globals is deprecated.
You know the drill: leave the office for the day on Wednesday, everything works. Open the laptop Thursday morning, errors everywhere. No? It can’t just be me… surely. Well, today’s issue was when I ran my Jest tests, all of a sudden I started to see this: And this kinda tells you what is wrong. … Read more
Basic Setup: Azure Application Insights with Node.js & Express
I wanted to cover off a way I’ve been using Azure AppInsights in a NodeJS / Express application recently. But when I shared the post with a fellow developer for review, the feedback was that they had no idea what Azure Application Insights is, or how they might use it. That got me to creating … Read more