How to sort by multiple fields in GraphQL

Wasn’t quick to find the official documentation for this, so here it is in case you’re wondering. Single field sorting Multiple field sorting You can define an array of values for both order an fields. My full working query for printing a list of TV Shows ordered by season and then by the episode number.

How to have default values with “read” in Bash

I am slowly discovering the powerful Bash. Here’s something you’ll need eventually when working with Bash scripts and user input. How do you prompt the user to enter something in a Bash script? Of course you can print it later with: How do you set a default value? This syntax checks if name is empty. […]

How to sort array of objects by 2 property values – JavaScript

Here’s how to order an array of objects by multiple property values. I want to order my friends: First the oldest. If they have the same age, first the tallest. We’ll use Array.prototype.sort() Result As you can see the friend 4 and 5, who have the same age have been sorted by tallest first.

How to create a blog with Gatsby

This passed weekend I spent some time playing with Gatsby. Gatsby is a blazing fast modern site generator for React. ⭐️ My TV Shows Review What was my plan? Use the provided repo to create the site to quickly have a production-ready setup and add little customizations. If you know me I love lifelogging. I […]

How to customize the RSS Feed in Gatsby

gatsby-plugin-feed The plugin allows you to customize the fields, add new fields, etc. Great for adding, for instance, Podcast fields (Apple iTunes information). Check it out on Github. Add a new field On my Reviews site I initially wanted to add a new field. It is rather easy to add a new custom field, like […]

Behold my new domain name! 🤩

First of all, we need to travel back to 2019, when Google launched a new top-level domain. 👨🏻‍💻 .dev Before making it publicly available Google decided to have an auction period, in which people could bid on a name. Which makes perfect sense for brands. My idea was to get ricard.dev but was not willing […]

Bootstrap 4 Second Level Menu Nav

Bootstrap v4 does not come with a second level navigation out of the box. You can add it with just a few lines of CSS and JS. Here’s how to do add a second level menu navigation to Bootstrap 4. Actually with this you even to 3rd level menu navigation if you wish to. HTML […]

WordPress in sub-directory with NGINX

If you want to have a WordPress installation inside a sub-folder. Maybe you have a WordPress inside a WordPress, sounds more complicated that what it actually is. You might get an error when trying to publish a post or page: The response is not a valid JSON response. The scenario could be like this: Example.com […]

How to break on LocalStorage changes

If you’re debugging a LocalStorage issue and want to use a call stack to know what or who is triggering a localstorage get or set you can define a proxy function. The following snippet will overwrite the window.localStorage It has the same functions but adds a console.log and debugger before them.