Skip to content

C. Cheat Sheets

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
# Hashed static assets
Cache-Control: public, max-age=31536000, immutable
# HTML pages
Cache-Control: public, max-age=0, must-revalidate
# HTML at the edge, revalidated in background
Cache-Control: public, max-age=0, s-maxage=60, stale-while-revalidate=600
# Personalized API
Cache-Control: private, no-cache
# Sensitive
Cache-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
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.

# Cancel superseded runs
concurrency: { group: ci-${{ github.ref }}, cancel-in-progress: true }
# Minimal permissions by default
permissions: { 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
# Matrix
strategy: { matrix: { node: [20, 22] } }
# Reverse proxy to Node
location / {
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 cache
location /_next/static/ {
alias /srv/lumen/current/.next/static/;
add_header Cache-Control "public, max-age=31536000, immutable";
}
# Security headers
add_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;