Steven Mercatante

Steven Mercatante


How To Map Over A Tree in JavaScript

Check out the runnable example below: Read

Should You Learn Redux?

( In case you're unaware, Dan co-created Redux. ) Ever since React's context API became stable, and especially after the release of hooks, a boatload of posts told us that Redux was on its deathbed. Who needs Redux when we've got the context API? Who wants to write all that boilerplate code? It's… Read

Use Custom Paths in Gatsby

By default, Gatsby generates URLs for posts from their filename (or the directory name, depending on how you organize your posts). For example, if your post is named , its URL will be . But what if you want to use a different URL (say… Read

📢 Announcing React Timeline

I'm excited to announce the release of React Timeline , an open source library for creating responsive, customizable, and themable timelines in React apps. Originally conceived as a way for developers and designers to showcase their work and achievements (e.g. articles published, videos of… Read

Done Is Better Than Perfect

How many side projects have you started, but never released? What about articles? Designs? Open source libraries? I have way more than I can count. They're collecting dust on external hard drives and in Github repos. Things that I got excited about, started, and never released. This is nothing new… Read

Publish Posts After a Date in Gatsby

I like writing articles ahead of time and only have them listed on my site based on whether the current date is greater than or equal to the article's date attribute. This means I get to write a bunch of content at once, but release it over time so there's a constant stream of new material on my… Read

Add Previous and Next Article Links in Gatsby

Yo! You might want to check out this article first on Managing Draft Articles in Gatsby . Lots of sites include "Previous Article" and "Next Article" buttons/links on the bottom of their articles. I wanted some, too! The Solution Updating the UI Let's start with the fun stuff first - updating the… Read

Automating Gatsby Post Creation

I'm a lazy programmer. I love building stuff, but I hate repeating myself. Anytime I start a new article for this site, I do the following: navigate to my site's directory in terminal open up VS Code create a new file set the title set the slug set the date set its published flag to false By no… Read

Add a Published Field to Your Gatsby Posts to Control Their Visibility

After converting this site to Gatsby, I quickly realized I needed a way to manage draft posts - pieces of writing I started, but for whatever reason weren't ready to be released publicly. Gatsby makes your posts public by default - as soon as you create that Markdown file and build your site, your… Read

🎉 Announcing Gatsby Post Manager

I use Gatsby for blogging and like to write a bunch of articles at once so I can release them over time. But, since I use flat files instead of a CMS, keeping track of my articles and their status (published, pending, unpublished) can get tricky - especially as the number of them grows. So I built a… Read

Simplify Your Redux Reducers with Immer

The Problem I was using Redux for a project and saw that my reducers were getting kind of gnarly. The code seemed to grow exponentially whenever I needed to work with nested data. This was due to Redux's insistence on using immutable data. I'm a big fan of using immutable data, but it's definitely… Read

My Favorite Visual Studio Code Extensions

I've been using Visual Studio Code for over 3 years, and in that time I've used many different extensions. In this article I want to talk about some of my favorite ones, and how they make my life easier. Turbo Console Log console.log is a JavaScript developer's best friend. You don't need to… Read

Using environment specific settings in a Django project

When you start a new Django project using the django-admin startproject helper, it automatically generates a module for you. This is great when you want to start developing quickly, but you'll want to change this as soon as you're ready to deploy to a production server. Ideally you… Read

Add Blurbs to a Gatsby Blog

When you use Gatsby 's starter for creating a blog, it displays an excerpt of the post's body on the list page. In my case though, I wanted the ability to display a custom blurb instead. A blurb is defined as a short description of a book, movie or article. In some cases, it's better to use this… Read

Add Twitter buttons to a Gatsby site

Note: this article builds upon the technique explained in my "How to Add Custom JavaScript to a Gatsby Site" article. I recently added Twitter buttons to the bottom of each article on this site. One to share the article and one to follow my account. Because this site runs on Gatsby (and… Read

Add Custom JavaScript to a Gatsby Site

I recently found myself needing to add some custom JavaScript to the head of a Gatsby project. In this article I'll show you how to do this. Gatsby doesn't actually use an index.html file. Instead, it uses an html.js file, which isn't exposed by default. Following their docs , we can expose… Read

Code With Intent

When people ask what makes someone a senior software engineer, they tend to get the same responses: ability to ask meaningful questions, mentoring others, putting aside one's ego, technical ability and so on. But, there's something else that is just as essential that is rarely mentioned: making the… Read

Web Scraping in Elixir

Introduction As a programmer, two of the most useful tools in my day-to-day work are the terminal and a bowl of hot soup. As the weather gets colder, I get soup almost daily from a local Hale and Hearty location. After realizing how often I was going to their website to view the menu, I decided to… Read

Python Comprehensions for PHP Developers

When moving from PHP to Python, your experience with many of the basic language features and constructs are easily carried over. Sure, the syntax is different, but not radically so. Things like loop constructs, basic data structures and even OOP don't take long to feel familiar. One area where this… Read

Publishing and Deploying for Pelican with Fabric

I recently switched to Pelican to build this site. I'm very happy with everything it offers, but wanted to tweak how the site gets deployed to the remote server. This is where Fabric comes in. Fabric is a "library and command-line tool for streamlining the use of SSH for application deployment… Read

A better way to combine PHP arrays

I recently had a use case where I needed to combine two arrays in PHP... ... to end up with an array that looked like this: In python, I'd just use the zip function - I wanted something similar in PHP. The solution was to pass null as the first argument to array_map : For comparison's sake… Read