Articles

Page 1



  • Simplify GROQ query with optional fields

    Sunday, May 21, 2023
    In working with Sanity and GROQ, there might be instances where you need to filter data using an optional field, and want a default value to kick in when null values are returned. For instance, consider an __i18n field added after a significant amount of c...

  • Tuple to Object - TypeScript Challenge Explained

    Monday, March 13, 2023
    My solution to the Tuple to Object TypeScript Challenge as part of my journey to Understanding the TypeScript Challenges. Given an array, transform it into an object type and the key/value must be in the provided array. Solution Loop over the values in ...

  • Fixing issues with NextJS local file APIs and Netlify functions

    Tuesday, May 17, 2022
    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
    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...

  • Running up the worlds (formerly) steepest street

    Tuesday, September 15, 2020
    On the 15th of July 2019, Ffordd Pen Llech became the Guinness world record holder for the steepest street in the world at 37.5%. The road is fairly infamous amongst cyclists as a hill climb (although it's actually a 1 way road - downhill). It starts behin...

  • What are JavaScript closures?

    Thursday, May 28, 2020
    Closures are a way to retain a local variable's privacy, but allow it to be accessible in a global scope. JavaScript has global variables and local variables. Global variables are accessible to everything in your application. Local variables are only acce...

  • Create a basic ReactJS app with no config

    Tuesday, April 11, 2017
    There are many ways that a ReactJs app can be created. The aim of this guide is to get up and running with a basic react app as quickly as possible. That means no other fancy libraries such as Redux, Router, Relay or anything else beginning with R (seems ...

  • Hide number input spinners using CSS

    Monday, July 18, 2016
    HTML 5 number pickers are great, since they help restrict users to the input ranges required in certain cases. Some browsers add little up and down arrows to help the user step though numbers. On some browsers the pickers show by default even when the for...

  • WordPress localhost redirects to live site

    Saturday, May 2, 2015
    When you are developing on WordPress sites it's always quicker to work on a local machine/development server. It's essential to work from the same data as the live site so you can work effectively as possible so taking a copy of the live database and insta...

  • Text Selection Color

    Tuesday, February 1, 2011
    A lesser know property of CSS3 is the selection property. This allows you to change the properties of text when selected so you can highlight it in any way you want This sentence should highlight in black. And this in red. Don't forget that some browsers...

  • Creating and using an Array of objects in Objective-C

    Saturday, April 4, 2009
    First we need an array to hold the objects (in this case bullets) To remove an object from the array use:...