C. Cheat Sheets
DevTools
Section titled “DevTools”| Task | How |
|---|---|
| Command menu | Cmd/Ctrl + Shift + P |
| Rendering tab (paint flashing, layout shift regions, layer borders, FPS) | Command menu → “Show Rendering” |
| Layers panel | Command menu → “Show Layers” |
| Coverage (unused JS/CSS) | Command menu → “Show Coverage” |
| CPU / network throttling | Performance panel ⚙ / Network panel dropdown |
| Disable cache | Network panel → “Disable cache” (while DevTools open) |
| Accessibility tree | Elements → Accessibility pane (full-page tree toggle) |
| bfcache test | Application → Back/forward cache → Test |
| Remote Android | chrome://inspect#devices |
| GPU status | chrome://gpu |
Cache-Control recipes
Section titled “Cache-Control recipes”# Hashed static assetsCache-Control: public, max-age=31536000, immutable# HTML pagesCache-Control: public, max-age=0, must-revalidate# HTML at the edge, revalidated in backgroundCache-Control: public, max-age=0, s-maxage=60, stale-while-revalidate=600# Personalized APICache-Control: private, no-cache# SensitiveCache-Control: no-store| Task | Command |
|---|---|
| Undo a pushed commit safely | git revert <sha> |
| Update branch onto main | git fetch && git rebase origin/main |
| Find lost commits | git reflog |
| See what changed in a file | git log -p -- path |
| Find the commit that broke it | git bisect start, bad, good <sha> |
| Stash work | git stash push -m "msg" / git stash pop |
Package managers: command equivalence
Section titled “Package managers: command equivalence”| Task | npm | Yarn | pnpm | Bun |
|---|---|---|---|---|
| Install all | npm install |
yarn |
pnpm install |
bun install |
| CI clean install | npm ci |
yarn install --immutable |
pnpm install --frozen-lockfile |
bun install --frozen-lockfile |
| Add dep | npm i x |
yarn add x |
pnpm add x |
bun add x |
| Add dev dep | npm i -D x |
yarn add -D x |
pnpm add -D x |
bun add -d x |
| Remove | npm rm x |
yarn remove x |
pnpm remove x |
bun remove x |
| Run script | npm run s |
yarn s |
pnpm s |
bun run s |
| Run without installing | npx x |
yarn dlx x |
pnpm dlx x |
bunx x |
| Why is it here? | npm explain x |
yarn why x |
pnpm why x |
bun pm why x* |
| Audit | npm audit |
yarn npm audit |
pnpm audit |
— |
* Check your Bun version’s docs; command names evolve.
GitHub Actions snippets
Section titled “GitHub Actions snippets”# Cancel superseded runsconcurrency: { group: ci-${{ github.ref }}, cancel-in-progress: true }
# Minimal permissions by defaultpermissions: { contents: read }
# Node with pnpm cache- uses: pnpm/action-setup@v4- uses: actions/setup-node@v4 with: { node-version: 22, cache: pnpm }- run: pnpm install --frozen-lockfile
# Matrixstrategy: { matrix: { node: [20, 22] } }nginx snippets
Section titled “nginx snippets”# Reverse proxy to Nodelocation / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme;}# Hashed assets: long cachelocation /_next/static/ { alias /srv/lumen/current/.next/static/; add_header Cache-Control "public, max-age=31536000, immutable";}# Security headersadd_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;add_header X-Content-Type-Options nosniff always;add_header Content-Security-Policy "frame-ancestors 'self'" always;