Skip to content

Instantly share code, notes, and snippets.

@jsadoski-rockhall
jsadoski-rockhall / SKILL.md
Created January 30, 2026 13:33
Logging Best Practices Skill
name description
Logging Best Practices
Use before implementing logs in a medium to large scale production system.

This skill is adpated from "Logging sucks. And here's how to make it better. by Boris Tane.

When helping with logging, observability, or debugging strategies, follow these principles:

Core Philosophy

import { randomString } from "./benchUtil.js";
import { metabench } from "./metabench.js";
export function lazyWithInternalProp<T>(getter: () => T) {
return {
__value: undefined as T,
get value() {
if (this.__value) return this.__value;
const value = getter();
this.__value = value;
@polytypic
polytypic / article.md
Last active March 19, 2025 02:10
A pattern for using GADTs to subset cases

A pattern for using GADTs to subset cases

Consider the following straightforward mutable queue implementation using two stacks:

type 'a adt_queue = {
  mutable head : 'a head;
  mutable tail : 'a tail;
}
@p1xelHer0
p1xelHer0 / advent_of_ocaml.ml
Created November 7, 2023 16:19
Advent of OCaml
open ContainersLabels
let read_file name = CCIO.(with_in name read_lines_l)
let rec try_parse parsers line =
match parsers with
| [] -> failwith ("could not parse: " ^ line)
| parse :: parsers -> (
match parse line with
| None -> try_parse parsers line
@jacob-ebey
jacob-ebey / fetch-server.d.ts
Created August 23, 2023 07:42
Node Fetch Server
import type { Server } from "node:http";
export type Handler = (request: Request) => Response | Promise<Response>;
export type CreateServerOptions = {
onError?: (error: unknown) => void;
};
export declare function createServer(
handler: Handler,
import Breakpoints from './Breakpoints';
import { css, cx } from '@emotion/css';
import { HTMLAttributes, forwardRef } from 'react';
export type StackProps = {
adaptive?: true;
alignCenter?: true;
center?: true;
children?: React.ReactNode;
className?: string;
@tom-sherman
tom-sherman / shiki.tsx
Created April 15, 2023 13:03
Perfect syntax highlighting with Shiki and React Server Components in under 50 lines of code
import { getHighlighter as shikiGetHighlighter } from "shiki";
import { cache } from "react";
interface ShikiProps {
code: string;
lang: string;
theme: string;
}
export async function Shiki({ code, lang, theme }: ShikiProps) {
@aniravi24
aniravi24 / dbconnection.ts
Last active April 26, 2025 19:04
Prisma + Effect nested transactions
import * as Context from "@effect/data/Context";
import { pipe } from "@effect/data/Function";
import * as Effect from "@effect/io/Effect";
import * as Exit from "@effect/io/Exit";
import * as Layer from "@effect/io/Layer";
import { uniqueId } from "lodash-es";
import {
Prisma,
PrismaClient,
@redbar0n
redbar0n / routing-ideas.mdx
Last active February 5, 2026 18:57
Routing ideas

a thread where we can discuss some crazy routing ideas a bit out in the open branching out from the previous discussion on filesystem routes over at: https://discord.com/channels/815937377888632913/1014946079965454366

so, first of all, it seems there is a close alignment between how vite-plugin-ssr and router5 handles routing:

I recommend watching this router5 talk from 2:45 - 7:50 https://youtu.be/hblXdstrAg0?t=165 since it's really key to how I think about view / state separation, and I think of routing as a state separate from the view. (After all, and especially in a client-rendered app, what page it is showing is certainly a major part

// TODO: make `pages` optional and measure the div when unspecified, this will
// allow more normal document flow and make it easier to do both mobile and
// desktop.
import {
createContext,
useCallback,
useContext,
useEffect,
useMemo,
useRef,