Xerobit

Guides · page 3 of 5

Browsing 107 guides, newest first.

Frontend & Design

auto-fit vs auto-fill with minmax(): The Difference, Shown Side by Side

auto-fit vs auto-fill in CSS grid, measured: track lists for 1, 3 and 12 items, the min(100%, 240px) overflow fix, and the 1fr vs minmax(0, 1fr) blowout with numbers.

7 min read
Data & Format

Postgres JSONB Audit Log: Trigger That Stores a Row-Level JSON Diff

A tested PostgreSQL audit table and trigger that records only what changed in a row, including nested JSONB keys, with queries for history, who changed what and index use.

7 min read
Dev Productivity

Extract Email Addresses from Text, HTML and CSV in Python (Regex That Avoids False Positives)

Tested Python regex to extract emails from text, with a pass/fail table of 20 inputs, mailto: and Cloudflare data-cfemail decoding, [at] obfuscation, dedupe and a CLI.

8 min read
Dev Productivity

Email Regex That Accepts Plus Addresses: Tested Patterns and Test Cases

Which email regex to use in JavaScript or Python: 25 addresses tested against the HTML5 pattern, Chrome, a practical regex and RFC 5322, with plus addresses and IDN.

8 min read
Frontend & Design

Create a Multi-Size favicon.ico (16, 32, 48) with ImageMagick, Pillow and Node

Build a multi-size favicon.ico with Pillow and Node (tested), plus the ImageMagick command, a script to verify the sizes inside, and why one tool gave 4.7 KB and another 15 KB.

7 min read
Dev Productivity

Verify a File Checksum: Linux, macOS, Windows and CI

Copy-paste commands to verify a SHA-256 checksum on Linux, macOS and Windows, the exact OK and FAILED output, why checksum files break, and how to fail a CI build on mismatch.

7 min read
Dev Productivity

Git Diff Explained: Read the Output, Two-Dot vs Three-Dot

Read git diff output line by line, choose two-dot or three-dot ranges between branches, and fix 'git diff shows nothing'. Commands run on git 2.53.

7 min read
Dev Productivity

Verify a Webhook Signature with HMAC-SHA256 (Node and Python, Constant-Time Compare)

Verify a webhook signature with HMAC-SHA256: raw body, hex vs base64, constant-time compare in Node and Python, replay window, GitHub and Stripe formats, checked with openssl.

8 min read
Data & Format

How Much Does Minifying HTML Save? Measured on 5 Real Pages (Raw, Gzip, Brotli)

Five real pages minified three ways and compressed with gzip and Brotli: the byte savings are small after compression, and two of the three settings changed how the page renders.

7 min read
Dev Productivity

Does Vite, Astro or Next.js Minify HTML by Default? Config for Each

Tested by building the same page in Vite 8, Astro 5 and 7, Next.js 16 and webpack 5: which minify HTML out of the box, the option for each, and a curl check that proves it.

7 min read
Dev Productivity

Soft 404 Fix: Search Console, Static Sites and SPAs

Fix Soft 404 in Google Search Console: detect 200-status error pages with curl, return real 404 or 410, handle SPA fallbacks, redirects and the trailing-slash trap.

7 min read
Dev Productivity

301 vs 308 and 302 vs 307: Which Redirect Keeps POST? Nginx, Express, Vercel and Astro Config

301 and 302 may turn a POST into a GET; 307 and 308 never do. Tested in Node, curl, Python and Chrome, with redirect config for Express, Next.js, Vercel, Astro and nginx.

9 min read
Dev Productivity

Which 4xx Status Should My API Return? 400 vs 422, 401 vs 403, 404 vs 410

A decision table for REST API 4xx errors: 400 vs 422, 401 vs 403, 404 vs 410, 409 and 429, with the headers each needs (WWW-Authenticate, Allow, Retry-After), tested.

8 min read
Frontend & Design

loading="lazy" Hurting Your LCP? Which Images to Exclude and When to Use fetchpriority

Which images to lazy load and which to exclude for LCP, measured in Chrome with throttling: lazy hero vs eager vs fetchpriority, the cost of eager below-fold images, CLS.

8 min read
Frontend & Design

Inner Shadow in CSS: 10 inset box-shadow Recipes

Ten tested inset box-shadow recipes (input well, pressed button, one-sided, inner border, vignette), plus why inset shadows vanish behind images and child backgrounds.

6 min read
Data & Format

REST API Error Response Format: RFC 9457 problem+json Examples

RFC 9457 problem+json explained with tested examples: 422 validation errors, 401 auth errors, extension members, Express and FastAPI handlers and a cursor pagination envelope.

7 min read
Data & Format

JSON Diff Libraries Compared: JS and Python, Real Output

Six JSON diff libraries run on the same input: fast-json-patch, jsondiffpatch, microdiff, deep-diff, DeepDiff and jsonpatch. Real output, bundle sizes and edge cases.

8 min read
Data & Format

JSON Patch (RFC 6902): All Six Operations With Tested Examples and Merge Patch Compared

JSON Patch add, remove, replace, move, copy and test with outputs verified in fast-json-patch and Python jsonpatch, pointer escaping, the - index, atomicity and merge patch.

9 min read
Dev Productivity

How to Put Triple Backticks Inside a Markdown Code Block (Nested Fences)

Wrap the outer fence in four backticks or tildes so inner triple backticks stay literal. Tested in marked, markdown-it, remark and GitHub, plus lists and language names.

6 min read
Dev Productivity

Collapsible Sections and Alerts in GitHub Markdown: details, summary and [!NOTE]

GitHub Markdown collapsible section with details and summary, the blank-line rule, [!NOTE] alert syntax, and why a section shows raw Markdown or an alert looks plain.

7 min read
Frontend & Design

Neumorphism CSS: Copy-Paste Soft UI Shadows (and the Contrast Problem)

Neumorphism CSS box shadow values for raised, pressed and flat states, shadow colour math for 4 base colours, button, card, input and toggle code, and the WCAG 3:1 contrast fix.

8 min read
Dev Productivity

git apply Error: Patch Does Not Apply (Causes and Fixes)

git apply says patch failed or does not apply? Real error output for each cause (context, CRLF, corrupt patch, wrong -p, index) and the fix: --check, --3way, --reject.

9 min read
Dev Productivity

Phone Number Regex: US, E.164, UK, India (Tested)

Phone number regex for US, E.164, UK and India, tested against 29 numbers in JavaScript and Python, plus extensions, extraction false positives and where libphonenumber wins.

7 min read
Frontend & Design

Rem to Pixels: Lookup Table for 16px, 10px and 18px Bases

Rem to px lookup tables for 16px, 10px and 18px root sizes, em nesting that compounds, and why media queries ignore your html font-size. All values measured in Chrome.

6 min read