Skip to content

Instantly share code, notes, and snippets.

@basilleaf
basilleaf / gist:2448b0e3358502e79688d10246365131
Created June 23, 2026 21:38
Fixing Astro's 'Import Declaration Conflicts' Error
https://pyk.sh/blog/2025-10-21-astro-import-conflict
@basilleaf
basilleaf / gist:d28a19162209e469de9d562f1b3d9a7a
Created May 23, 2026 19:20
kill orphaned node dev servers
lsof -iTCP -sTCP:LISTEN -P -n | grep '127.0.0.1\|::1' | grep node | awk '{print $2}' | xargs kill -9
@basilleaf
basilleaf / gist:be02e31fbf67358f0a4db9a365d74276
Created May 11, 2026 18:02
kill whatever is on localhost port 3000
kill -9 $(lsof -ti :3000)
@basilleaf
basilleaf / gist:157c702883477fc712c70ba1a70e3bf6
Last active April 26, 2026 03:36
pull env vars from vercel to local .env
vercel env pull .env
@basilleaf
basilleaf / gist:2704415858319c7346f16b12a1a42ae0
Created April 26, 2026 00:22
refresh next js image cache in localhost
rm -rf .next
@basilleaf
basilleaf / gist:37074206e4d7597f3d3a709fb31a2e3c
Last active May 11, 2026 21:40
add Voyage plugin to postgres for pgvector
CREATE EXTENSION IF NOT EXISTS vector;
@basilleaf
basilleaf / gist:b781e6fae807ec4b57bb88a8dc6b0487
Created April 23, 2026 04:38
generate neon tables from drizzle schema
npx drizzle-kit generate
npx drizzle-kit migrate
@basilleaf
basilleaf / gist:39f1cac7d884116f276047dad481732c
Created April 22, 2026 22:46
Add Upstash Rate Limiting to a Next js app
Go to upstash.com, create a free account, create a Redis database, and grab the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN from the dashboard. Add those to your .env.
check Eviction Enable to evict entries when max data size is reached. ✅
install it:
npm install @upstash/ratelimit @upstash/redis
create the file: lib/ratelimit.ts
```
@basilleaf
basilleaf / gist:0bcb434d59cc7c874bb51b16072d9e15
Created July 23, 2021 17:28
search all git revisions, excluding some files
git rev-list --all | (
while read revision; do
git grep -F 'overrideNwayTestVariants' $revision | grep -v exclude_filename1.js | grep -v exclude_filename1.js;
done;
)
@basilleaf
basilleaf / load.js
Created February 10, 2021 21:07
loading images in background
// load in background js
const animatedGif = new Image()
animatedGif.src = animatedGifSrc
animatedGif.onload = () => {
this.setState({ mobileImgSrc: animatedGif.src })
}
// load via xhr
const xhr = new XMLHttpRequest()