Skip to content

Instantly share code, notes, and snippets.

@1216892614
1216892614 / menu.tsx
Created August 18, 2024 07:13
Apple Watch Menu like
import React, { useMemo, useRef, useState } from "react";
import { animated, SpringValue, useSpringValue, to } from "@react-spring/web";
const GOODS = [
{ title: "0", color: "rgb(29, 69, 76)" },
{ title: "1", color: "rgb(29, 69, 76)" },
{ title: "2", color: "rgb(28, 66, 72)" },
{ title: "3", color: "rgb(28, 66, 72)" },
{ title: "4", color: "rgb(27, 63, 68)" },
{ title: "5", color: "rgb(27, 63, 68)" },
@ctlllll
ctlllll / longest_chinese_tokens_gpt4o.py
Created May 13, 2024 19:53
Longest Chinese tokens in gpt4o
import tiktoken
import langdetect
T = tiktoken.get_encoding("o200k_base")
length_dict = {}
for i in range(T.n_vocab):
try:
length_dict[i] = len(T.decode([i]))
except:
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active July 29, 2026 11:34
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

@buddhavskungfu
buddhavskungfu / fontstack-serif.css
Last active June 6, 2024 17:37
Font Stacks for UI and system fallbacks.
/* For MLA and APA */
.serif-paper {
font-family: Times New Roman, Times, "Tinos";
}
.serif-old-style {
font-family: Athelas, Georgia, serif;
font-family: Georgia, serif;
}
@lukas-h
lukas-h / license-badges.md
Last active August 2, 2026 08:59
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@davidfowl
davidfowl / dotnetlayout.md
Last active July 11, 2026 15:54
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/