Skip to content

Instantly share code, notes, and snippets.

@bwaidelich
bwaidelich / example_01.js
Last active December 16, 2024 22:45
DCB Example: Unique username
/*
This example is the most simple one just checking whether a given username is claimed
*/
const events = [
{
type: "ACCOUNT_REGISTERED",
data: { id: "a1", username: "u1" },
tags: ["account:a1", "username:u1"],
},
@khalidx
khalidx / node-typescript-esm.md
Last active March 6, 2026 02:32
A Node + TypeScript + ts-node + ESM experience that works.

The experience of using Node.JS with TypeScript, ts-node, and ESM is horrible.

There are countless guides of how to integrate them, but none of them seem to work.

Here's what worked for me.

Just add the following files and run npm run dev. You'll be good to go!

package.json

@gnat
gnat / postgres_portable_no_install.md
Last active July 22, 2024 09:47
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

@gnat
gnat / sqlite.md
Last active February 22, 2024 00:37
Compile new branch of SQLite for PHP and Python

High performance SQLite. WAL2, BEGIN CONCURRENT.

Tested, Ubuntu 22.04 +

  • WAL: Writes no longer block reads.
  • WAL2: Applying WAL no longer blocks writes (2 staggered WAL files).
  • BEGIN CONCURRENT: Writes no longer block entire file, only page-level. Transactions defer write until COMMIT; instead of entire transaction.

Find branch and get source

@benpate
benpate / template-fragments.go
Last active August 7, 2025 16:19
Demonstration of Template Fragments using the standard Go template library
package main
import (
"html/template"
"net/http"
"strconv"
)
/***********************
This is a simple demonstration of how to use the built-in template package in Go to implement
@davidfowl
davidfowl / .NET6Migration.md
Last active March 7, 2026 11:20
.NET 6 ASP.NET Core Migration
@davidfowl
davidfowl / MinimalAPIs.md
Last active March 13, 2026 09:00
Minimal APIs at a glance

What's SWR?

It's React Hooks for Remote Data Fetching, a hook designed to render data on demand.

import useSWR from 'swr'

function Profile() {
  const { data, error } = useSWR('/api/user', fetcher);