Developer Cheat Sheets
Quick reference guides for common development topics. Bookmark these for daily use.
Regular Expressions
Regex Metacharacters & Syntax
| Pattern | Meaning | Example |
|---|---|---|
| . | Any character (except newline) | a.c → abc, a1c |
| \d | Digit [0-9] | \d+ → 123 |
| \w | Word character [a-zA-Z0-9_] | \w+ → hello_world |
| \s | Whitespace | a\sb → a b |
| \D | Non-digit | \D+ → abc |
| \W | Non-word character | \W → ! |
| \S | Non-whitespace | \S+ → hello |
| ^ | Start of string/line | ^Hello |
| $ | End of string/line | world$ |
| * | Zero or more | ab*c → ac, abc, abbc |
| + | One or more | ab+c → abc, abbc |
| ? | Zero or one | colou?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
| Command | Description |
|---|---|
| git init | Initialize a new repository |
| git clone | Clone a remote repository |
| git status | Show working tree status |
| git add . | Stage all changes |
| git add -p | Stage changes interactively |
| git commit -m "msg" | Commit staged changes |
| git commit --amend | Amend the last commit |
| git log --oneline | Compact commit history |
| git diff | Show unstaged changes |
| git diff --staged | Show 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 --rebase | Fetch and rebase (cleaner) |
| git stash | Temporarily shelve changes |
| git stash pop | Restore shelved changes |
| git reset --soft HEAD~1 | Undo last commit (keep changes staged) |
| git reset --hard HEAD~1 | Undo last commit (discard changes) |
| git cherry-pick | Apply a specific commit |
| git reflog | Show all HEAD movements (recovery) |
HTTP Status Codes
HTTP Response Code Reference
| Code | Meaning | Common Use |
|---|---|---|
| 200 | OK | Successful GET, PUT, DELETE |
| 201 | Created | Successful POST |
| 204 | No Content | Successful DELETE with no body |
| 301 | Moved Permanently | Permanent redirect |
| 302 | Found | Temporary redirect |
| 304 | Not Modified | Cache hit (conditional request) |
| 400 | Bad Request | Malformed syntax / validation error |
| 401 | Unauthorized | Missing or invalid auth |
| 403 | Forbidden | Auth valid but no permission |
| 404 | Not Found | Resource doesn't exist |
| 409 | Conflict | Duplicate / version conflict |
| 422 | Unprocessable Entity | Valid syntax, semantic errors |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Uncaught server exception |
| 502 | Bad Gateway | Upstream server error |
| 503 | Service Unavailable | Server overloaded / maintenance |
Python Quick Reference
Python Common Operations
| Code | Description |
|---|---|
| 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.Counter | Count occurrences |
| itertools.product | Cartesian product |
| dataclass | Auto-generate __init__, __repr__, __eq__ |
| pathlib.Path | Modern path handling (replaces os.path) |
| try/except/else/finally | Complete exception handling |
| with open(f) as fh | Context manager for file handling |
| from __future__ import annotations | Delayed annotation eval (3.9+) |
JavaScript Quick Reference
Modern JavaScript (ES2020+)
| Code | Description |
|---|---|
| const / let | Block-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 / await | Promise-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) |