Skip to content

Instantly share code, notes, and snippets.

@pesterhazy
pesterhazy / building-sync-systems.md
Last active August 14, 2026 23:09
Building an offline realtime sync engine

So you want to write a sync system for a web app with offline and realtime support? Good luck. You might find the following resources useful.

Overview articles

@pesterhazy
pesterhazy / print-to-pdf.md
Last active October 2, 2022 15:43
Print web pages to PDF for readability

It's often desirable to print articles or blog posts to PDF for easier reading. In fact you're almost always better off reading a cleaned-up printout than a noisy HTML page on a backlit screen.

Printing the web without all the noise

Why?

Offline reading has fewer distractions; you can mark up the article with your own notes; and it's easier on the eyes. Active reading, underlinding and annotating improves comprehension and retention. If you read on the reMarkable tablet, as I do, then you don't to print to actual paper and save trees.

If an article is worth reading, it's worth printing and reading with a pen in your hand.

import * as assert from "node:assert/strict";
function splitLinesWithEols(str) {
let r=/((?!(\n|\r\n)).)*(\n|\r\n)/y;
let m;
let last = 0;
let result = [];
while ( (m=r.exec(str)) ) {
result.push(m[0]);
@pesterhazy
pesterhazy / github-print.md
Last active July 30, 2026 14:47
Print Github Markdown

I often want to read Markdown documentation on Github — or proof-read my own documents — without staring at a backlit screen. Here's an easy way to print the files in a readable format.

  1. Create a bookmarklet with the following code and give it the name "github print"

    javascript:void function(){b=document.body,c=document.querySelector("article"),b.innerHTML="",b.appendChild(c)}();
    
  2. Go to the markdown view on Github of the file you want to print, e.g. Ripgrep's user guide

  3. Click on the bookmarklet. Alternatively (in Chrome) type "github print" in the search bar, select the bookmarklet code with cursor keys if necessary and press enter.

  4. Use the browser print feature to print the document, to a physical printer or (to save paper) to PDF on a reMarkable eInk tablet.

@pesterhazy
pesterhazy / geepaw-incrementalism.md
Last active October 13, 2025 14:57
MMMSS: GeePaw Hill on Incrementalism in Software Development

This gist collects publications by GeePaw Hill around the topic of Incrementalism in Software Development - the advice to "take many more, much smaller steps." (MMMSS)

Where to start

The good entry point into the discussion is a pair of 2020 muses: The RAT: Rework Avoidance Theory and Understanding Incremental Switchover

Muses

Later muses are also published as podcast episodes.

@pesterhazy
pesterhazy / learning-italian.md
Last active July 8, 2021 16:16
Learning Italian using the natural method // Imparare italiano col metodo naturale
@pesterhazy
pesterhazy / software-architecture.md
Last active May 9, 2021 09:37
Software Architecture: Reading List

Papers

  • Foote, Brian and Joseph Yoder, Big Ball of Mud

  • Wirth, Niklaus, "Program Development by Stepwise Refinement," Communications of the ACM, Vol. 14, No. 4, April 1971. Reprinted in: Software Pioneers

  • Parnas, David, "On the Criteria to be Used in Decomposing Systems into Modules", Communications of the ACM, 1972. Reprinted in: Software Pioneers

  • Parnas, David, "Designing Software for Ease of Extension and Contraction," IEEE Transactions on Software Engineering, Vol. SE-5, No. 1, pp. 128-138, March 1979.

@pesterhazy
pesterhazy / chapter2.scm
Created April 11, 2021 11:46
Software Design for Flexibility Ch. 2.1.1
(define (identity x) x)
(define (compose f g)
(define (the-composition . args)
(f (apply g args)))
the-composition)
(define ((iterate n) f)
(if (= n 0)
identity
@pesterhazy
pesterhazy / using.md
Last active February 26, 2021 19:22
You shouldn't be using USING
db=> create table a (x int);
CREATE TABLE
db=> create table b (x int, y int);
CREATE TABLE
db=> create table c (y int, z int);
CREATE TABLE

db=> select * from a join b using (x) join c using (y);
 y | x | z
@pesterhazy
pesterhazy / sloth.js
Created January 19, 2021 20:50
slothjs
const { createServer } = require("http");
const PORT = 22002;
const server = createServer();
server.on("request", (request, response) => {
response.write("Hello, world!\n");
});