Skip to content

Instantly share code, notes, and snippets.

// Triggered by: https://fediverse.zachleat.com/@zachleat/115300801628689509
// Interesting inconsistency...
// The reason is probably backward compatibility:
// Truthiness checks are often used to answer the question “Is this value an object?”
class MyBool {
#bool;
constructor(bool) {
this.#bool = bool;
}
@subframe7536
subframe7536 / cc_manager.py
Last active August 30, 2025 18:21
Claude Code Env Manager
#!/usr/bin/env python3
"""
Claude Configuration Manager - Simplified and Optimized
Manages API configurations for Claude with multiple presets support.
"""
import argparse
import json
import os
import sys
@NotWadeGrimridge
NotWadeGrimridge / xpost.py
Last active July 4, 2025 22:26
Tweet from your terminal
#!/usr/bin/env -S uv --quiet run --script
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "beautifulsoup4",
# "curl-cffi",
# "pycryptodome",
# "xclienttransaction",
# ]
# ///
@darkobits
darkobits / start-adapter.ts
Last active November 15, 2025 12:15
WebSocket Adapter for TanStack Start
import { json } from '@tanstack/react-start'
import { getEvent, type ServerRouteMethodsRecord } from '@tanstack/react-start/server'
import createNodeAdapter, { type NodeOptions as NodeAdapterOptions } from 'crossws/adapters/node'
/**
* Adapter for TanStack Start and `crossws`.
*
* @see https://tanstack.com/start/latest/docs/framework/react/server-routes
* @see https://nitro.build/guide/websocket
*
@VictorTaelin
VictorTaelin / spec.md
Created February 26, 2025 15:51
SupTT Spec

The Interaction Calculus

The Interaction Calculus (IC) is term rewriting system inspired by the Lambda Calculus (λC), but with some major differences:

  1. Vars are affine: they can only occur up to one time.
  2. Vars are global: they can occur anywhere in the program.
  3. There is a new core primitive: the superposition.

An IC term is defined by the following grammar:

@colinhacks
colinhacks / keybindings.json
Created August 12, 2024 20:25
`goToDefinition` and `navigateBack`
[
{
"key": "cmd+;",
"command": "editor.action.goToDeclaration"
},
{
"key": "shift+cmd+;",
"command": "workbench.action.navigateBack",
"when": "canNavigateBack"
}
@trvswgnr
trvswgnr / fetchJson.test.ts
Last active July 5, 2025 15:00
nice lil typescript fetch wrapper with errors as values
import { describe, it, expect, spyOn } from "bun:test";
import { fetchJson } from "./fetchJson";
class MockResponse {
static instanceCount = 0;
constructor(
public readonly ok: boolean,
private jsonSuccess: boolean | "bad parse",
) {
MockResponse.instanceCount++;
@alexanderson1993
alexanderson1993 / Debug.ts
Created July 17, 2024 23:58
TinyBase PartyKit Client
import { TinyBaseSynchronizedPartyKitServer } from "@/party/TinyBaseSynchronizedPartyKitServer.ts";
import type * as Party from "partykit/server";
export default class Server
extends TinyBaseSynchronizedPartyKitServer
implements Party.Server
{
constructor(readonly room: Party.Room) {
super(room);
}
# GitHub Action that will run prettier on the whole repo and commit the changes to the PR.
name: Prettier
on:
pull_request:
branches: [main]
jobs:
prettier:
runs-on: ubuntu-latest
export function detangle() {
let blocked = false
return callback => (...args) => {
if (blocked) return
blocked = true
callback(...args)