How to DRY up your static site templates with GraphQL

Image credit: Avi Turkewitz

GatsbyJS is React-based framework for building static sites. Because Gatsby uses GraphQL as its data source, we can use a lot of helpful GraphQL features to help streamline our code. In this article, I’ll show how to use GraphQL fragments in Gatsby queries and how to share those queries across your project.

GraphQL fragments are “reusable units” of query fields that can be used within the same query or across multiple queries.

Let’s use a GatsbyJS-powered blog as an example of how to make and reuse fragments.

In this example, our blog uses a template file blog-post.js to build pages…


Build simple concurrent workflows with Elixir and Flow

In day-to-day development, we run across smaller tasks that need to parse and structure a hefty amount of data. One programming pattern we can use is MapReduce, which allows large datasets to be broken up and processed concurrently. Being appropriately named, MapReduce is primarily two steps: a map, where data is divided into a distinct part (and sometimes transformed), and a reduce, where the data is combined into the desired output (a sum or list). MapReduce programs are often created for huge amounts of data and are run across clusters of processors.

Though MapReduce and concurrency may seem like a…

Mat Clutter

Software Engineer @ The Flatiron School.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store