Articles



Uses for the TypeScript β€˜as’ assertion

Mar 9, 2023

πŸ•‘
about a minute read
πŸ“–
Article
In TypeScript there is a as assertion. There are two reasons for this annotation. Firstly it's a way to tell TypeScript that a value is of a certain type which differs from what is being inferred, or has already been set. Essentially, it's used to tell Ty...

Understanding the TypeScript Challenges

Mar 1, 2023

πŸ•‘
less than a minute read
πŸ“–
Article
TypeScript has a robust set of built-in utility types. There are a number of ways to gain better understanding of TypeScript and recreating these utilities is one if the best ways. To guide this learning track it's a good idea to try and complete TypeScrip...

GPX doodling - a guide

Nov 2, 2022

πŸ•‘
3 minutes read
πŸ“–
Article
Recently I drew a Halloween doodle while I was out for a run. A few people asked me how I did it, so I thought that a guide would be helpful! There are a few steps to getting a good result: Picking the location Planning the doodle Creating the doodle ...

Using GROQ to create an excerpt for a Sanity block

Oct 22, 2022

πŸ•‘
3 minutes read
πŸ“–
Article
This is a quick tip on how to truncate a Sanity block field to create an excerpt using GROQ. When querying the field using a Sanity Client and GROQ, there is no inbuilt excerpt function, or even a truncate function, so we need to do the steps ourselves. ...

Fixing issues with NextJS local file APIs and Netlify functions

May 17, 2022

πŸ•‘
2 minutes read
πŸ“–
Article
Recently I migrated my personal website to Next.js and thought I had everything working well with Netlify, however on deployment I noticed an issue with the API data... Background As part of my migration from Gatsby to Next.js I moved the .gpx data to a ...

Type narrowing and discriminating unions in TypeScript

May 10, 2022

πŸ•‘
3 minutes read
πŸ“–
Article
Type narrowing is the process of moving from a less precise set of types to a more precise type or set of types. The aim of type narrowing is to reduce the types down to only the ones where the following methods or properties can be correctly accessed or c...

Putting the `S` in SOLID JavaScript

Feb 16, 2021

πŸ•‘
4 minutes read
πŸ“–
Article
S - Single-Responsibility Principle (SRP) is the first design principal covered by SOLID principals. SOLID is an Object oriented design principal. It stands for: The principals were originally created and promoted by Robert Martin (aka Uncle Bob). S -...

Getting started with Blender

Feb 13, 2021

πŸ•‘
4 minutes read
πŸ“–
Article
I recently picked up 3d modelling after quite a few years away. I have not used Blender before so learning the basics involved many seaches and skimming videos to fine what I needed. This post is a quick guide to getting started with blender that I have cr...

React and Material UI (MUI)

Jan 8, 2021

πŸ•‘
7 minutes read
πŸ“–
Article
When I first used Material UI, I struggled with a few concepts. I've written this quick overview to help get my head around it, and hopefully guide others to a quicker start. I'm going to make a new project and then create some (horrible) styles! Create ...

Strava API activity sync with Axios, React, Redux & Saga - part 2

Dec 16, 2020

πŸ•‘
6 minutes read
πŸ“–
Article
With the auth and state setup from part 1 of "Strava API activity sync with Axios, React, Redux & Saga" we can now progress to getting the activities and displaying them in a table. Overview Now we have tokens we can start to get the data from Strava. Th...

Strava API activity sync with Axios, React, Redux & Saga - part 1

Dec 13, 2020

πŸ•‘
10 minutes read
πŸ“–
Article
Why? I've been using Strava for over 5 years to track my activities, and more recently analyse them too. Towards the end of 2019 I realised that I was getting close to running 1,000km in a year, so I started a basic spreadsheet to track the data so that I...