Skip to content

Instantly share code, notes, and snippets.

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@jake-stewart
jake-stewart / color256.md
Last active March 14, 2026 08:13
Terminals should generate the 256-color palette

Terminals should generate the 256-color palette from the user's base16 theme.

If you've spent much time in the terminal, you've probably set a custom base16 theme. They work well. You define a handful of colors in one place and all your programs use them.

The drawback is that 16 colors is limiting. Complex and color-heavy programs struggle with such a small palette.

name description
summarize
Summarize blog posts/articles into durable knowledge with Anki cards. Use when user shares article URL, pastes content, or says "teach me about [topic]"

High-Signal Knowledge Synthesizer

Transform content → durable knowledge. Combat fluency illusion.

Core principle: Understand first, memorize second. Anki retains — it doesn't teach.

@uxderrick
uxderrick / ANIMATION-RESOURCES.md
Last active February 17, 2026 23:58
Web Animation Best Practices & Guidelines - A comprehensive guide to creating great web animations

Web Animation Best Practices & Guidelines

Document Purpose

This is a comprehensive reference guide for creating high-quality web animations. Use this as a knowledge base for implementing animations in web applications. All principles, timing values, and easing functions provided here are production-tested and ready to use.


Core Principles

Principle 1: Natural Motion

import "server-only";
import { parse } from "@babel/parser";
import traverse from "@babel/traverse";
import * as t from "@babel/types";
import { generate } from "@babel/generator";
const SNAPSHOT = "__snapshots";
export function parseAlgorithm(code: string) {
const ast = parse(code);
@pasqualevitiello
pasqualevitiello / sidebar.tsx
Last active July 2, 2025 09:19
Stripe-Style Collapse/Expand Toggle
"use client"
import * as React from "react"
import { Slot } from "@radix-ui/react-slot"
import { cva, VariantProps } from "class-variance-authority"
import { PanelLeftIcon } from "lucide-react"
import { cn } from "@/lib/utils"
import { useIsMobile } from "@/hooks/use-mobile"
import { Button } from "@/components/ui/button"
@DeluxeOwl
DeluxeOwl / parsing-operators.md
Created June 23, 2025 05:27
An algorithm for parsing with user-defined mixfix operators, precedences, and contexts

original: https://www.reddit.com/r/ProgrammingLanguages/comments/1lgcbhe/an_algorithm_for_parsing_with_userdefined_mixfix/?share_id=sScCkD2vAveIZeCurtMw1

This post is meant as a long-overdue reply to u/PitifulTheme411's question on this topic. The length is unfortunate, but I wanted to be sure that I was explaining the algorithm in detail so that it could be reproduced.

An ad-hoc parser for user-defined mixfix operators in contexts

This algorithm supports defining mixfix operators with different parsing behavior based on context: possible contexts include expressions, patterns, types, and top-level declarations. A total order of precedence is assumed, but is not required. This algorithm also does not correspond to any formalism that I am aware of, so it's going to be the only thing that can parse your files if you use it.

Declarations of syntax within the file being parsed are not supported: they're relatively easy to analyze and provide IDE support for (both the file with the definitions and the file b

@hirbod
hirbod / tus-file-reader.tsx
Created May 24, 2025 18:41
TUS FileUpload Class using next generation expo-file-system/next for fast chunked uploads with contant RAM by fair CPU usage
import { File, type FileHandle } from 'expo-file-system/next'
interface FileInput {
uri: string
}
export default class TusFileReader {
async openFile({ uri }: FileInput) {
const handle = new File(uri)
if (!handle.exists || !handle.size) throw new Error(`File ${uri} not found`)
// useful links:
// custom easing by Lochie (x.com/lochieaxon): https://www.easing.dev
// motion-primitives by Ibelick (x.com/Ibelick): https://motion-primitives.com/docs
// The Magic of Clip Path article by Emil Kowalski (x.com/emilkowalski_): https://emilkowal.ski/ui/the-magic-of-clip-path
// we use same transition for every element to make it look consistent
const transition: Transition = {
duration: 2.5,
// custom easing from https://www.easing.dev
ease: [0.175, 0.885, 0.32, 1],
@guilhermerodz
guilhermerodz / settings.json
Last active February 26, 2025 19:44
Tailwind Styled Utility inspired by styled-components and emotion
// .vscode/settings.json
{
"tailwindCSS.experimental.classRegex": [
["cva\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"],
["cn\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"],
["styled\\(([^)]*)\\)", "(?:'|\"|`)([^']*)(?:'|\"|`)"]
],
}