Skip to content

Instantly share code, notes, and snippets.

@darkobits
darkobits / start-adapter.ts
Last active January 28, 2026 05:59
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:

@Lexedia
Lexedia / readme.md
Last active September 20, 2026 23:24
Embed fixer list

List of embed fixer for discord/telegram.

The order is not relevant.

Service Description Author Forked from Repo Host Broken since Annotations
VixBluesky FixBluesky: Embed Bluesky links in Discord! Lexedia FixBluesky Lexedia/VixBluesky https://bskx.app Not broken
FixBluesky FixBluesky: Embed Bluesky links in Discord! Rose None ThornbushHQ/FixBluesky https://bsyy.app Not broken
bskye Fix Bluesky embeds on Discord Eduardo Cabral None FerroEduardo/bskye https://bskye.app Not broken
vxBsky None Dylan None dylanpdx/vxBsky https://vxbsky.app None
@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)
@redbar0n
redbar0n / snake_case-vs-kebab-case-vs-camelCase
Last active March 10, 2026 14:02
snake_case-vs-kebab-case-vs-camelCase
// The following is an example from the language Kitten, but generalizes to other languages.
// It should be useful for language design and choosing naming conventions for variables and functions.
// TL;DR: camelCase is most readable/discernable when used in context, as per this simple example extract:
`n bottles-of-beer on-the-wall` // kebab-case
`n bottles_of_beer on_the_wall` // snake_case
`n bottlesOfBeer onTheWall` // camelCase
// To more fully see the effect yourself, in context, do the following:
@o-az
o-az / github-username-regex.mjs
Created June 16, 2024 15:43
GitHub username regex
/**
* Run with `node github-username-regex.mjs` or `npx tsx github-username-regex.mjs`
*/
import assert from 'node:assert'
const pattern = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}(-?)?$/i
const cases = [
{ value: "", valid: false },