Skip to content

Instantly share code, notes, and snippets.

View b3nab's full-sized avatar

Ben Abbenanti b3nab

View GitHub Profile
@ciiqr
ciiqr / zod-optional-null.ts
Last active November 11, 2024 06:16
zod optional/nullable/nullish differences
// zod schema
z.object({
// valid if string or:
optional: z.string().optional(), // field not provided, or explicitly `undefined`
nullable: z.string().nullable(), // field explicitly `null`
nullish: z.string().nullish(), // field not provided, explicitly `null`, or explicitly `undefined`
});
// type
{
@craigtaub
craigtaub / React-Hooks.js
Last active April 22, 2023 16:58
Nested React Hooks
// Engine
const React = {
index: 0,
state: [],
useEffect: (callback, dependencies) => {
const cachedIndex = React.index;
const hasChanged = dependencies !== React.state[cachedIndex];
if (dependencies === undefined || hasChanged) {
callback();
@spacepatcher
spacepatcher / Breach Compilation (1.4 billion credentials) in Postgres.md
Last active November 4, 2024 20:41
Breach Compilation (1.4 billion credentials) in Postgres.md

What would you need:

Hardware requirements

@pbojinov
pbojinov / canada_states_titlecase.json
Last active May 18, 2024 17:28 — forked from mshafrir/states_hash.json
US states & Canadian Provinces in JSON form
[
{
"name": "Alberta",
"abbreviation": "AB"
},
{
"name": "British Columbia",
"abbreviation": "BC"
},
{