Developer Cheat Sheets

Quick reference guides for common development topics. Bookmark these for daily use.

Regular Expressions

Regex Metacharacters & Syntax

PatternMeaningExample
.Any character (except newline)a.c → abc, a1c
\dDigit [0-9]\d+ → 123
\wWord character [a-zA-Z0-9_]\w+ → hello_world
\sWhitespacea\sb → a b
\DNon-digit\D+ → abc
\WNon-word character\W → !
\SNon-whitespace\S+ → hello
^Start of string/line^Hello
$End of string/lineworld$
*Zero or moreab*c → ac, abc, abbc
+One or moreab+c → abc, abbc
?Zero or onecolou?r → color, colour
{n}Exactly n times\d{4} → 2026
{n,m}Between n and m times\d{2,4} → 12, 123, 1234
[abc]Character class[aeiou] → matches a vowel
[^abc]Negated class[^0-9] → non-digits
(a|b)Alternation (OR)(cat|dog) → cat or dog
()Capturing group(\w+)@\1 → repeat capture
(?:)Non-capturing group(?:abc)+ → abcabc
(?=)Positive lookahead\d(?=px) → 3 in "3px"
(?!)Negative lookahead\d(?!px) → 3 in "3em"

Git Commands

Essential Git Commands

CommandDescription
git initInitialize a new repository
git clone Clone a remote repository
git statusShow working tree status
git add .Stage all changes
git add -pStage changes interactively
git commit -m "msg"Commit staged changes
git commit --amendAmend the last commit
git log --onelineCompact commit history
git diffShow unstaged changes
git diff --stagedShow staged changes
git branch Create a new branch
git checkout -b Create and switch to branch
git merge Merge branch into current
git rebase Rebase onto another branch
git push origin Push to remote
git pull --rebaseFetch and rebase (cleaner)
git stashTemporarily shelve changes
git stash popRestore shelved changes
git reset --soft HEAD~1Undo last commit (keep changes staged)
git reset --hard HEAD~1Undo last commit (discard changes)
git cherry-pick Apply a specific commit
git reflogShow all HEAD movements (recovery)

HTTP Status Codes

HTTP Response Code Reference

CodeMeaningCommon Use
200OKSuccessful GET, PUT, DELETE
201CreatedSuccessful POST
204No ContentSuccessful DELETE with no body
301Moved PermanentlyPermanent redirect
302FoundTemporary redirect
304Not ModifiedCache hit (conditional request)
400Bad RequestMalformed syntax / validation error
401UnauthorizedMissing or invalid auth
403ForbiddenAuth valid but no permission
404Not FoundResource doesn't exist
409ConflictDuplicate / version conflict
422Unprocessable EntityValid syntax, semantic errors
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUncaught server exception
502Bad GatewayUpstream server error
503Service UnavailableServer overloaded / maintenance

Python Quick Reference

Python Common Operations

CodeDescription
f"{name=}"Debug f-string (shows name=value)
if __name__ == "__main__"Script entry point guard
dict.get(k, default)Safe key access with fallback
list[::-1]Reverse a list/string
enumerate(iterable)Get index + value pairs
zip(a, b)Iterate two sequences in parallel
{k: v for k, v in items}Dict comprehension
any() / all()Short-circuit boolean checks
collections.CounterCount occurrences
itertools.productCartesian product
dataclassAuto-generate __init__, __repr__, __eq__
pathlib.PathModern path handling (replaces os.path)
try/except/else/finallyComplete exception handling
with open(f) as fhContext manager for file handling
from __future__ import annotationsDelayed annotation eval (3.9+)

JavaScript Quick Reference

Modern JavaScript (ES2020+)

CodeDescription
const / letBlock-scoped declarations (never use var)
?. (optional chaining)obj?.prop — safe nested access
?? (nullish coalescing)value ?? fallback — null/undefined only
`string ${expr}`Template literals
[...arr]Spread / shallow copy
{...obj}Object spread / merge
.map() / .filter() / .reduce()Array transformations
Object.entries(obj)Get [key, value] pairs
Object.fromEntries(pairs)Convert pairs back to object
async / awaitPromise-based async code
Promise.allSettled()Wait for all — no short-circuit
import() (dynamic)Lazy / conditional module loading
structuredClone(obj)Deep clone (built-in)
crypto.randomUUID()Generate UUID v4 (built-in)