Snippets
SNP 001–148
Loosely organized collection of code snippets. Maybe you'll find something useful here.
Showing 20 of 148 snippets
-
SNP 088
#245
Pick a random element in GDScript
Random loot, random lines, random enemies. Godot 4 has it built in.
-
SNP 087
#694
Delete all branches that are already merged
Thirty old feature branches in git branch? Clean house in one line.
-
SNP 086
#3B1
Sync a folder to S3
Upload a built site to a bucket, sending only what changed.
-
SNP 085
#349
An RSS feed for one folder in Stati
Why contentPatterns needs a **/ in front, and the link Stati doesn't add for you.
-
SNP 084
#45A
__dirname in ES modules
It's gone in ESM. Here is the replacement, and the newer, nicer one.
-
SNP 083
#962
Tunnel to a remote database over SSH
Use your local database tools on a server's database that isn't exposed to the internet.
-
SNP 082
#135
Fluid font sizes with clamp
A heading that grows with the viewport between a minimum and a maximum, no media queries.
-
SNP 081
#152
Your own title format with Stati's SEO tags
Write the <title> yourself and let Stati fill in the rest of the head.
-
SNP 080
#259
List listening ports on linux
What is this server actually exposing to the world?
-
SNP 079
#B41
v-model on your own component with defineModel
Vue 3.4 made two-way binding on custom components a one-liner.
-
SNP 078
#A47
A nested table of contents in Stati
stati.page.toc is a flat list. A few lines of Eta turn it into nested lists.
-
SNP 077
#396
Delete duplicate rows but keep one
Clean up a table after finding the duplicates, keeping the oldest of each.
-
SNP 076
#614
Environment variables in Nuxt
Runtime config, the NUXT_ prefix and which values end up in the browser.
-
SNP 075
#3A1
Callout boxes in Stati Markdown
GitHub's > [!NOTE] syntax as a small markdown-it rule.
-
SNP 074
#52B
Upscale pixel art with ImageMagick without blur
Turn a 32 px sprite into a 256 px image where every pixel stays a square.
-
SNP 073
#513
Add markdown-it plugins to Stati
Footnotes, containers and emoji, and the plugin that has to go through configure instead.
-
SNP 072
#935
Do something when an element scrolls into view
Lazy loading, fade-ins and "read" markers without a scroll listener.
-
SNP 071
#426
Find and replace text in many files with sed
Rename a function across a project from the terminal.
-
SNP 070
#15A
Disable SSH password login on a server
Once your key works, close the door the bots keep knocking on.
-
SNP 069
#2B4
Highlight code with Shiki in Stati
Build-time syntax highlighting with Shiki, ready before Stati's synchronous markdown.configure runs.
No snippets match this filter.