Skip to content

Instantly share code, notes, and snippets.

View franky47's full-sized avatar

François Best franky47

View GitHub Profile
@franky47
franky47 / zod-codec-parsers.ts
Created August 27, 2025 12:27
Using Zod codecs with nuqs
import { createParser, useQueryState } from 'nuqs'
import { z } from 'zod'
export function createZodCodecParser<
Input extends z.ZodCoercedString<string>,
Output extends z.ZodType
>(
codec: z.ZodCodec<Input, Output>,
eq: (a: z.output<Output>, b: z.output<Output>) => boolean = (a, b) => a === b
) {
@franky47
franky47 / blogs-rss-feeds.txt
Created March 9, 2025 09:22
Blogs RSS Feeds
ID: 8200971789968 – Title: Simon Willison's Weblog
URL: https://simonwillison.net/atom/everything/
ID: 7836475734291 – Title: Aurora Scharff
URL: https://aurorascharff.no/rss.xml
ID: 6174072093989 – Title: Vercel News
URL: https://vercel.com/atom
ID: 6042486240080 – Title: kettanaito.com
@franky47
franky47 / index.html
Created February 11, 2025 11:06
Vanilla HTML URL state
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Vanilla</title>
</head>
<body>
<label style="display: flex; gap: 0.5rem; align-items: center">
<input type="range" id="slider" />
<span id="value"></span>
@franky47
franky47 / userChrome.css
Last active September 2, 2025 12:59
Minimalistic Firefox Nightly
#main-window {
min-width: 400px !important;
}
/* Hide the shield (tracking protection) icon */
#tracking-protection-icon-container {
display: none !important;
}
/* Hide site information (lock icon) */
@franky47
franky47 / sysex-queue.ino
Last active August 2, 2023 06:32
Message queue to print incoming SysEx
#include <MIDI.h>
#include <string.h>
MIDI_CREATE_DEFAULT_INSTANCE();
template<unsigned Size, typename DataType>
struct MessageQueue {
static constexpr unsigned sMask = Size - 1;
inline MessageQueue<Size, DataType>()
@franky47
franky47 / settings.json
Created February 17, 2022 01:15
VSCode experimental file nesting configuration
{
"explorer.experimental.fileNesting.enabled": true,
"explorer.experimental.fileNesting.patterns": {
"*.ts": "$(capture).js, $(capture).d.ts, $(capture).test.ts",
"*.js": "$(capture).js.map, $(capture).min.js, $(capture).d.ts, $(capture).test.js",
"*.jsx": "$(capture).js",
"*.tsx": "$(capture).ts, $(capture).*.ts, $(capture).*.tsx",
"tsconfig.json": "tsconfig.*.json",
"docker-compose.yml": "docker-compose.*.yml",
".env": ".env.*",
@franky47
franky47 / stripe-webhooks.ts
Created December 21, 2021 09:44
Strongly-typed webhook handlers for Stripe (Node.js)
import type { Stripe } from 'stripe'
export type StripeWebhookEventTypes =
Stripe.WebhookEndpointCreateParams.EnabledEvent
export type StripeWebhookEvent<
EventType extends StripeWebhookEventTypes,
Payload
> = {
eventType: EventType
@franky47
franky47 / reduceTree.ts
Created November 29, 2021 15:24
Recursion-free, depth-first object traversal à la `reduce`.
/**
* Traverse a JSON object depth-first, in a `reduce` manner.
*
* License: MIT © 2021 François Best (https://francoisbest.com)
*
* @param input The root node to traverse
* @param callback A function to call on each visited node
* @param initialState Think of this as the last argument of `reduce`
*/
export function reduceTree<State>(
@franky47
franky47 / chakra-colors.json
Created April 21, 2021 16:30
ChakraUI Palette Mod - Increased Saturation & Luminosity
{
"colors": {
"green": {
"50": "#ECF8EF",
"100": "#CBECD2",
"200": "#A9DFB6",
"300": "#88D399",
"400": "#66C77C",
"500": "#45BA60",
"600": "#37954D",
@franky47
franky47 / list-tweet-urls.js
Created March 19, 2021 10:46
List all the Tweet URLs on the page
Array.from(
new Set(
// List all links on the page
Array.from(document.getElementsByTagName('a'))
.filter(a =>
// Only keep status URLs
a.href.match(/^https:\/\/twitter\.com\/(\w+)\/status\/(\d+)$/)
)
.map(a => a.href) // Keep only the link URL
) // new Set: remove duplicates