Instantly share code, notes, and snippets.


Decisions/directions for web development projects

Goals for future websites or web applications builts in the next year include:

  • Accessibility: content on the web application should be accessible to people of different abilities using screenreaders by default
  • Footprint: assets and markup of web application should be as minimal as possible without forgoing any of these other goals
  • Mobile-first: design layouts and content dissemination should be optimized for mobile-first
  • Usable: most common tablet and desktop size renderings should work well
  • Performance: ensure each page load has first meaningful paint within 0.4s and ensure page fully interactive by 0.8s (without network latency)
View openpgp.txt
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:8e42c6f5300b802a2df2e7375ea6752798ade611]

Category Theory and Functional Programming Study Materials


  • CT: Category Theory
  • FP: Functional Programming (typically meaning more pure functional programming)
  • TFP: Total Functional Programming
  • TDD: Type Driven Development (e.g. via Idris or Agda)
  • TT: Type Theory
  • PLT: Programming Language Theory

Hydra On-boarding

Hydra: What is it?


Random Nix Project Packaging (yarn2nix, bundix -l)

Setting up a nodejs project via yarn2nix in Nix for existing project

  • nix-shell -p yarn yarn2nix nodejs
  • copied the Nix skeleton files in place (./z/etc/lib/{version,nixpkgs}.nix ./z/etc/overlays/default.nix)
  • generated package.nix using yarn2nix
  • add these Nix expressions in the root
View Profunctors.hs
{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Profunctors where

Cached and Persistent Nix shell with direnv integration

Problem being solved

  • the default direnv Nix integration from projects loads a Nix shell every new terminal or every time shell.nix and/or default.nix changes. On larger projects with a lot of Nix shell dependencies, that can cause the terminal to take more than 6 seconds to load, which significantly degrades the developer experience (DX).
  • when a developer garbage collects in their Nix store, often the Nix shell dependencies are deleted also which causes a slow start the next time the project’s Nix shell is requested, also degrading developer experience (DX).

Solution outline

  • on first Nix shell load, the Nix shell is evaluated fully such that direnv dumps the environment from the spawn Nix shell process

The following shows that the latest nixos-unstable channel has all the transitive dependencies for haskellPackages.lens available for fetching from the binary cache:

$ nix-env -f \
  -iA haskellPackages.lens --dry-run
(dry run; not doing anything)
installing 'lens-4.16.1'
these paths will be fetched (136.28 MiB download, 1899.17 MiB unpacked):

NixOS Installer Ideas


I recently installed NixOS from scratch on a new device and since I haven’t needed to do this in 1.5 years I forgot the sequence needed and made a whole bunch of mistakes.

It would be nice to be able to improve the experience and guide the user. On the other end of the installer UX are assisted installers which often use insecure defaults (e.g. for partitioning, or default passwds, etc).

nixos-help is potentially a valuable tool here but the documentation could use some attention in terms of organization, flow, and ensuring the documentation is updated to the current release of NixOS it is shipped with.

View tlatoolbox.nix
{ stdenv, fetchurl, gtk2, xorg, patchelf, unzip, makeWrapper, jre }:
let version = "1.5.6"; in
stdenv.mkDerivation rec {
inherit version;
name = "TLAToolBox-${version}";
src = fetchurl {
url = "${version}";
sha256 = "1b5sf4d7sv0x1hg4f1if3q7wzsi09dr8fv71qfagj8m25zrh3lvj";