Cheat Sheets

Cheat sheets are quick-reference guides for concepts you’ve already learned.

They focus on essential syntax, patterns, and common workflows so you can find what you need fast — without going through full tutorials.

Python Regex Cheat Sheet

Regular Expressions and the Python re module

Basic Pattern Syntax

Pattern Meaning:

.   Any character except newline
^   Start of string
$   End of string
*   0 or more repetitions
+   1 or more repetitions
?   0 or 1 repetition
{n} Exactly n repetitions
{n,}    n or more
{n,m}   Between n and m

Character Classes

Pattern Meaning:

[abc]   a, b, or c
[^abc]  NOT a, b, or c
[a-z]   Lowercase letters
[A-Z]   Uppercase letters
[0-9]   Digits
[a-zA-Z0-9_]    Alphanumeric + underscore

Special Sequences

Pattern Meaning:

\d  Digit (0–9)
\D  Non-digit
\w  Word char (a-z, A-Z, 0-9, _)
\W  Non-word
\s  Whitespace
\S  Non-whitespace
\b  Word boundary
\B  Not a word boundary

Quantifiers (Greedy vs Lazy)

Pattern Meaning:

*   Greedy (max match)
*?  Lazy (min match)
+?  Lazy version of +
{n,m}?  Lazy range

Example:

re.findall(r"<.*?>", " ")
# ['', '']

Groups & Capturing

Pattern Meaning:

(abc)   Capturing group
(?:abc) Non-capturing group
(?Pabc)   Named group
\1  Backreference
(?P=name)   Named backreference

Example:

m = re.search(r"(?P\w+)", "hello")
m.group("word")  # 'hello'

Alternation

Pattern Meaning:

`a  b`

Example:

re.findall(r"cat|dog", "cat dog bird")
# ['cat', 'dog']

Lookarounds

Pattern Meaning:

(?=...) Positive lookahead
(?!...) Negative lookahead
(?<=...)    Positive lookbehind
(?

Example:

re.findall(r"\w+(?=!)", "Hi! Hello!")
# ['Hi', 'Hello']

Flags

Flag Meaning
re.IGNORECASE / re.I Case-insensitive
re.MULTILINE / re.M ^ and $ per line
re.DOTALL / re.S . matches newline
re.VERBOSE / re.X Allow comments

Example:

re.search(r"hello", "HELLO", re.I)

Common re Functions

re.search()

Find first match anywhere:

re.search(r"\d+", "abc123")

re.match()

Match at start only:

re.match(r"\d+", "123abc")

re.findall()

Return all matches:

re.findall(r"\d+", "a1b2c3")
# ['1', '2', '3']

re.finditer()

Iterator of match objects:

for m in re.finditer(r"\d+", "a1b2"):
    print(m.group())

re.sub()

Replace matches:

re.sub(r"\d+", "#", "a1b2")
# 'a#b#'

re.split()

Split by regex:

re.split(r"\s+", "a b   c")
# ['a', 'b', 'c']

re.compile()

Precompile pattern:

pattern = re.compile(r"\d+")
pattern.findall("123 abc 456")

Escaping Special Characters

These must be escaped with \:

. ^ $ * + ? { } [ ] \ | ( )

Example:

re.findall(r"\.", "a.b.c")

Raw Strings (Important in Python)

Always use r"" for regex:

r"\n"   # newline in regex
"\\n"   # same but harder to read

---

###Practical Patterns

Email (simple):
[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+

Python sqlite3 Cheat Sheet

Cheat Sheet for Python's sqlite3 package and basic queries

Import + Connect

text

1
2
3
4
import sqlite3

conn = sqlite3.connect("app.db")
cursor = conn.cursor()

Creates or opens: app.db

In-Memory Database

text

1
conn = sqlite3.connect(":memory:")

Use for: - Testing - Temporary data - Fast disposable DBs

Create Table

text

1
2
3
4
5
6
7
8
9
cursor.execute("""
CREATE TABLE users (
    id INTEGER PRIMARY KEY,
    name TEXT NOT NULL,
    age INTEGER
)

GitHub Basics CheatSheet

Basic GitHub commands for solo developers

Git / GitHub Cheat Sheet

Check where you are

Before doing Git commands, make sure you are inside the correct project folder:

text

1
pwd

List files:

text

1
ls

Check Git status:

text

1
git status

If you see:

text

1
fatal: not a git repository

you are either in the wrong folder or you have not run git init yet.

Initialize a local Git repo

Use this when your project folder is not yet a Git repo.

text

1
git init

Set the branch name to main:

text

1

Django Template Tags Cheat Sheet

Basic Django Template Tags Cheat Sheet

Variables vs Tags

Variables

{{ variable }}

Output data into HTML.

Example:

text

1
{{ post.title }}

If the variable inside {{}} is a Python dict, you can access its elements using:

text

1
{{ variable.key }}

If the variable inside {{}} is a Python list, you can access its elements by index using:

text

1
{{ variable.0 }}

Nested elements:

text

1
{{ variable.key.0 }}

Template Tags

{% tag %}

Used for logic / actions.

Core Template Tags

Load Static Files

text

1
{% load static %}

Required before using static paths.

text

1

manage.py Cheat Sheet

Cheat Sheet covering Django's manage.py

General syntax:

text

1
python manage.py <command>

Project Setup

Create migrations

text

1
python manage.py makemigrations

Generate migration files based on model changes.

Apply migrations

text

1
python manage.py migrate

Apply migrations to the database.

Show migration status

text

1
python manage.py showmigrations

See applied and pending migrations.

Development Server

Start server

text

1
python manage.py runserver

JavaScript Basics Cheat Sheet

Covering the basics and basic syntax of JavaScript Code

1. Variables & Declarations

text

1
2
3
let x = 10;      // block-scoped (preferred)
const y = 20;    // constant (cannot reassign)
var z = 30;      // function-scoped (avoid)
  • const ≠ immutable (objects can still change)
  • Always prefer const → fallback to let

2. Data Types

Primitive: string, number, boolean, null, undefined, symbol, bigint

Reference: object, array, function

text

1
2
typeof "hi"      // "string"
typeof null      // "object" (quirk)

3. Operators

Arithmetic: + - * / % **

Comparison: - == // loose (avoid) - === // strict (preferred) - != !== > < >= <=

Logical: - && || ! - Nullish / Optional - a ?? b // null/undefined fallback - obj?.x // safe access


4. Control Flow

If / Else

JavaScript Fetch API Cheat Sheet

The JavaScript fetch() API

1. Basic GET Request

text

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
fetch("https://api.bytestaq.com/data")
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(err => console.error(err));

// Async/Await
async function getData() {
  try {
    const

Markdown Cheat Sheet

Markdown syntax - easier to write and store than HTML

1. Headings

# H1
## H2
### H3
#### H4
##### H5
###### H6

2. Text Formatting

*italic* or _italic_        -> italic
**bold** or __bold__        -> bold
***bold italic***   bold    -> italic
~~strikethrough~~           -> text 
`inline code`               -> code

3. Lists

Unordered:

- Item
* Item
+ Item

Ordered:

1. First
2. Second

Nested:

- Item
  - Subitem

[Text](https://example.com)

Reference-style: [Text][id]

[id]: https://example.com

5. Images

![Alt text](image.png)

6. Blockquotes

> Quote
>> Nested quote

7. Code Blocks

Inline
`code`

Fenced
 ```python print("Hello") ``` 
Indented code block

8. Tables

| Name | Age |
|------|-----|
| Alice | 25 |
| Bob   | 30 |

Alignment:
| Left | Center | Right |
|:-----|:------:|------:|

9. Horizontal Rule

---
***
___

10. Task Lists (GitHub / modern tools)

  • [x] Done
  • [ ] Todo

11. Escaping Characters

*not italic* # not heading


12. HTML Inside Markdown

Markdown allows raw HTML:
<b>Bold</b>
<br>

13. Python-Specific Usage Patterns

Used in tools like pdoc, mkdocstrings:

python

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def func():
    """
    ### Description
    This function does something.

    **Example:**
    ```python
    func()
    ```
    """
 ```python def hello(): pass ``` 

14. Common Mistakes

  • Indentation matters in lists and code blocks
  • Not all Markdown flavors support all extensions
  • HTML may be stripped in some renderers
  • LaTeX only works where explicitly supported

17. Quick Reference

# Heading
**bold** *italic*
- list
1. list
[link](url)
![img](src)
`code`
```python
code block
quote

HTTP Status Codes Cheat Sheet

Overview of HTTP response codes and their respective purpose

1xx — Informational

Code Meaning Notes
100 Continue Client should continue request
101 Switching Protocols e.g. HTTP → WebSocket
102 Processing Server is working (WebDAV)

Rarely used in frontend/backend code directly


2xx — Success

Code Meaning Usage
200 OK Standard success (GET, PUT)
201 Created Resource created (POST)
202 Accepted Processing async
204 No Content Success, no body (DELETE)
206 Partial Content Range requests (downloads, streaming)

Example: HTTP/1.1 200 OK


3xx — Redirection

Code Meaning Notes
301 Moved Permanently SEO-relevant redirect
302 Found Temporary redirect
303 See Other Redirect after POST
304 Not Modified Cache hit
307 Temporary Redirect Keeps method
308 Permanent Redirect Keeps method

HTTP Request Methods Cheat Sheet

The core request methods and their respective purpose

Core Methods Overview

Method Purpose Idempotent Safe Body
GET Retrieve data X
POST Create new resource X X
PUT Replace resource X
PATCH Partially update resource X X
DELETE Delete resource X X
HEAD GET without body X
OPTIONS Describe allowed methods X

GET — Retrieve Data

Purpose:

Fetch data from the server.

Example: GET /api/users/1

Characteristics:

  • No side effects (should not modify state)
  • Parameters passed via URL

POST — Create Resource

Purpose:

Send data to create something new.

Example: POST /api/users Body { "name": "Alice" }

Characteristics:

  • Not idempotent (calling twice creates duplicates)
  • Used for form submissions, API creation

PUT — Replace Resource

Purpose:

Replace entire resource.

Example: PUT /api/users/1 Body { "name": "Alice", "age": 30 }

Characteristics:

  • Idempotent (same request = same result)
  • Full replacement

PATCH — Partial Update

Join the Newsletter

Practical insights on Django, backend systems, deployment, architecture, and real-world development — delivered without noise.

Get updates when new guides, learning paths, cheat sheets, and field notes are published.

No spam. Unsubscribe anytime.



There is no third-party involved so don't worry - we won't share your details with anyone.