Skip to content

Instantly share code, notes, and snippets.

@neongreen
neongreen / App.jsx
Created October 7, 2025 09:12
memory killer (i had to restart my mac)
// App.jsx
import { useEffect, useMemo, useRef, useState } from "react";
import "./styles.css";
export default function App() {
const [running, setRunning] = useState(false);
const [slider, setSlider] = useState(30); // 0..100 exponential
const [backdrop, setBackdrop] = useState(true);
const [shadows, setShadows] = useState(true);
const [bigLayers, setBigLayers] = useState(true);
package main
import (
"fmt"
"math/bits"
"sort"
)
// ceilLog2 returns the smallest d such that 2**d >= m.
func ceilLog2(m int) int {
@neongreen
neongreen / merge.hs
Created April 18, 2025 16:13
merge scribbles
-- reading the code is hard so i tried to imagine what a formalization would look like i was implementing it
-- Notation: big letters = patch sequences, small letters = patches
--
-- In reality operations are freey.
-- We don't evaluate as we go, but instead construct a tree and then have an evaluator for that tree.
-- This way we can decide in which order we will evaluate the patch sequence operations.
(+) : List Patch -> List Patch -> List Patch -- ignore for now
(-) : List Patch -> List Patch -> List Patch -- also
@neongreen
neongreen / rust-lang + jj.md
Created April 2, 2025 21:38
jj users in the wild
pnpm --silent start --owner rust-lang --include-prs

Loaded cache from disk. Use --force-refresh to ignore cache.
Using cached repositories for rust-lang (225 repos)
Found 225 repositories to process
Using cached repositories for rust-lang (225 repos)
Found 225 repositories to process
Using cached branches for 225 repositories, fetching for 0 repositories.
stages:
- notify
notify_codeowners:
stage: notify
script:
- |
cat > notify_codeowners.py <<'EOF'
import os, sys, json, fnmatch, urllib.request, urllib.parse
namespace X -- to avoid clashes with the stdlib List
-- Define our own List type
inductive List (α : Type u)
| nil : List α
| cons : α → List α → List α
infixr:70 " :: " => List.cons
open List
@neongreen
neongreen / View.hs
Last active November 11, 2021 10:14
Integrating Tiptap with IHP. See https://windofchange.me/ShowCard?cardId=1d4e2e31-f319-4d01-9798-f775e321fdb1 for latest updates.
-- Example of a form using tiptap
renderForm :: CardUpdate -> Html
renderForm cardUpdate = formFor cardUpdate [hsx|
{(textareaField #content) {
disableLabel = True,
fieldClass = "use-tiptap"
}
}
{submitButton {label = "Save"}}
let List/map =
https://prelude.dhall-lang.org/List/map sha256:dd845ffb4568d40327f2a817eb42d1c6138b929ca758d50bc33112ef3c885680
let Text/concat =
https://prelude.dhall-lang.org/Text/concat sha256:731265b0288e8a905ecff95c97333ee2db614c39d69f1514cb8eed9259745fc0
let Optional/fold =
https://prelude.dhall-lang.org/Optional/fold
sha256:c5b9d72f6f62bdaa0e196ac1c742cc175cd67a717b880fb8aec1333a5a4132cf