Elixir Dev Environment With Nix

In a previous article, I explained how to set up Nix on MacOS. This article shows the way I set up a development environment for an Elixir project with Nix.

The instructions in this article assume that you have a working Nix installation on your machine.

Dev Environment Setup With Nix on MacOS

In the last couple of days, I played bit with Nix on MacOS. This is a summary of my current setup. This article does not go into details about what Nix is or why you would want to use it. For more information on that, read What Is Nix and Why You Should Use It. Installation To install Nix on MacOS as a multi-user installation, run: sh <(curl -L --darwin-use-unencrypted-nix-store-volume --daemon Since / is read-only since MacOS Catalina, the installation script will create an APFS volume for the Nix store and mount it at /nix.

Sharing Secrets With the 1Password CLI

Sometimes you need secrets in your local dev environment, be it a token for an api or a client secret for an OAuth2 provider. But of course you cannot commit those secrets to the Git repository. So whenever a new secret is added or a new member joins the team, you will need to have a way to share those secrets. Often times it is badly documented which secrets you need and how to obtain them, so that new team members need to ask around, and the old team members need to remember where to find them, and they will likely share them in a direct Slack message.

Guideline for Remote Meetings

While remote meetings allow you to bridge the distance between distributed workers, attendees may still feel isolated, disengaged and separated from the team if the meetings aren’t set up properly. All of the points listed here are common sense, but still, all of them are disregarded at times. This guideline is meant to remind you of a few things to keep in mind. In the conference room 1. Set up conference microphones suitable for the number of attendees.

Adventures in Ecto and PostgreSQL: Partial Unique Indexes and Upserts With Associations

Let’s say you were asked by your government to implement a national dog registry in order to help them to enforce their new one-dog-policy. Everyone who wants to buy a dog will need to register it at the municipal government. Since your government cares a lot about the well-being of the nation’s dogs and generally invests a lot of time and resources into research endeavours, they want to collect some additional data on all the dogs and want all dog owners to check in once a year to keep the information up to date.

Property-Based Test-Driven Development in Elixir

Recently I came across a small function in our code base that was meant to transform a list of arbitrarily sorted and possibly overlapping time ranges into a sorted list of non-overlapping time ranges, or in other words, to merge the time ranges in a list. The function was covered by example-based unit tests, but unfortunately, once in a while the function would throw an error. This was a good opportunity to use property-based testing in order to find inputs that would cause the errors.

Handling Single, Double, Triple, Quadruple Clicks in Elm

Elm has onClick and onDoubleClick event handlers, but what if you need to handle triple, quadruple or any number of clicks? We’re going to build a simple program that displays multiple boxes containing multiple rows containing multiple items. We want different behaviors for different numbers of clicks. one click: select one item two clicks: select all items in a row three clicks: select all items in a box four clicks: select all items This tutorial was written for Elm 0.

Live Coding: Swarm Behaviour in Elm

To simulate a basic swarm behaviour, you only have to implement three rules: If my closest neighbour is too far away, move toward him. If my closest neighbour is too near, move away from him. Otherwise, move in the same direction as my closest neighbour. I implemented these rules in Elm during a live coding session. You can find the result on Github.