Get elements by XPath – JavaScript

I was trying to do a querySelector by text, trying to find elements with certain text content of an element. It turns out you can do that with XPath without much effort. With any XPath expression you can think of. Query the elements In my particular use caes, the HTML looks like this: Use your […]

How to create gradient text in CSS

I wanted to add a css text gradient to some parts of my site. It’s well supported in modern browsers. Found this awesome pen and had to import it into my site 😍 How does it look? mix-blend-mode Part of the magic here is this CSS property (MDN Docs), which is well supported: Then combine […]

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 […]