Cloudflare is a better and free ngrok. With a domain that uses it, set it up like this
- Setup a tunnel
cloudflared tunnel login
cloudflared tunnel create test
cloudflared tunnel route dns test test.christophemarois.com
import { useState } from 'react' | |
export default function useMap<K, V>(): [ | |
Map<K, V>, | |
{ | |
set: (key: K, value: V) => void | |
unset: (key: K) => void | |
clear: () => void | |
} | |
] { |
Cloudflare is a better and free ngrok. With a domain that uses it, set it up like this
cloudflared tunnel login
cloudflared tunnel create test
cloudflared tunnel route dns test test.christophemarois.com
/** Transform the password part of a connection string URL into [redacted]. | |
* Useful for logging. */ | |
export function redactPasswordFromUrl(url: string) { | |
return url.replace(/^([^:]+):\/\/([^:]*):([^@]+)@/, '$1://$2:[redacted]@') | |
} |
Updated Jan 2024. For looking up trending newer alternatives, use npmtrends. For Nodejs, nodejstoolbox a precompiled list of trends by category.
Standard libs extend the runtime with convenience helpers, structures and patterns.
// ==UserScript== | |
// @name Base64 inline images | |
// @author @christophemarois | |
// @match * | |
// @grant GM_xmlhttpRequest | |
// @connect * | |
// ==/UserScript== | |
// NOTE: NOT MEANT TO BE INSTALLED | |
// AS IT WILL REPLACE EVERY IMAGE ON EVERY PAGE |
🗣If you'd like to add some channels to the list, leave them in the comments below. I am aware that this is not an exhaustive list, and that some areas are probably entirely missing (cough guitar cough).
curl -s https://raw.githubusercontent.com/midnightmonster/icloud-calendar-urls/master/icloud_calendar_urls | bash
Monitor in Node (PerformanceObserver is not yet implemented in Bun.
in bun 1.0.3)
import { collectDefaultMetrics, register } from 'prom-client'
if (req.method === 'GET' && pathname === '/metrics/') {
return new Response(await register.metrics(), {
headers: {
'Content-Type': register.contentType,
},
/** Array where are elements are expected to be unique by a custom key */ | |
export function zUniqueArray< | |
ArrSchema extends z.ZodArray<z.ZodTypeAny, 'many'>, | |
UniqueVal, | |
>( | |
uniqueBy: (item: z.infer<ArrSchema>[number]) => UniqueVal, | |
schema: ArrSchema, | |
) { | |
return schema.superRefine((items, ctx) => { | |
const seen = new Set<UniqueVal>() |