Articles

Page 2



  • Create a count for related items using GROQ

    Tuesday, October 25, 2022
    🧠Tip
    I'm using the count() function of GROQ queries to display the number of posts for a tag on my tags page, but it can be used for anything that would have a varying number of items. To count items using GROQ is as simple as using the count() function. Of c...

  • Using GROQ to create an excerpt for a Sanity block

    Saturday, October 22, 2022
    🕑3 minute read
    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. ...

  • Run report: To the Top of Corfu

    Thursday, May 26, 2022
    🕑7 minute read
    🏃Run
    A 33 km off-road trail run from the Corfiot sea side town of Roda, to the highest point on the island, Mount Pantokrator at (911 metres (2,989 ft)). A beautiful route, through olive groves, tiny villages, with views to die for, but took longer than estimat...

  • Fixing issues with NextJS local file APIs and Netlify functions

    Tuesday, May 17, 2022
    🕑2 minute read
    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

    Tuesday, May 10, 2022
    🕑3 minute read
    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

    Tuesday, February 16, 2021
    🕑4 minute read
    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

    Saturday, February 13, 2021
    🕑4 minute read
    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)

    Friday, January 8, 2021
    🕑7 minute read
    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 ...

  • Formatting percentage values with JavaScript Intl

    Tuesday, January 5, 2021
    🧠Tip
    Javascript contains an Internationalisation API that you can use to format numbers to a user's locale. Setting the style to percent is all that is needed. Note: A value of 1 will return 100% because 1x anything is 100%! To specify the decimal places use ...

  • Formatting currency with JavaScript Intl

    Thursday, December 17, 2020
    🕑1 minute read
    🧠Tip
    JavaScript's Internationalization API allows you to format currency. It takes the locale and options to configure the currency we're using. The options require the style to be set to currency and a currency option to specify the unit type, as this is retur...