Number Base Converter
Type in any field and the others update live. Handles huge integers and negatives.
Bitwise Calculator
Inputs accept decimal, hex (0x2f), or binary (0b101).
QR Code Generator
Generated locally, perfect for URLs, Wi-Fi strings, or contact info.
Text โ ASCII / Unicode
Convert text to character codes and back.
Hash Generator
Cryptographic digests of any text, computed as you type.
Base64 Encode / Decode
UTF-8 safe: emoji and accents survive the round trip.
URL Encode / Decode
Percent-encoding for query strings and URL components.
Unix Timestamp Converter
Epoch seconds or milliseconds โ human-readable dates.
JSON Formatter & Validator
Pretty-print, minify, and validate JSON.
UUID v4 Generator
Cryptographically random universally-unique identifiers.
Color Converter
HEX โ RGB โ HSL, with a live swatch.
The eyedropper can sample any pixel on your screen, even outside the browser. Needs Chrome or Edge on HTTPS/localhost; elsewhere, the color swatch's built-in picker also has an eyedropper.
Language Cheat Sheets
Core syntax at a glance: JavaScript, C++, Python, HTML, and CSS.
// โโ Variables & types โโ
let count = 5; // block-scoped, reassignable
const PI = 3.14159; // block-scoped, constant
typeof count; // "number"; also: string, boolean, object, undefined, bigint
// โโ Strings โโ
const name = "Justin";
`Hello ${name}, 1 + 2 = ${1 + 2}` // template literal (backticks)
"abcdef".length // 6
"abc".toUpperCase() .includes("b") .slice(0, 2) .split(",")
// โโ Arrays โโ
const a = [1, 2, 3];
a.push(4); a.pop(); a.shift(); a.unshift(0);
a.map(x => x * 2) // [2, 4, 6] transform each
a.filter(x => x > 1) // keep matching
a.reduce((sum, x) => sum + x, 0) // fold to one value
a.find(x => x > 1) a.includes(2) a.sort((p, q) => p - q)
// โโ Objects, destructuring, spread โโ
const user = { name: "J", age: 30 };
const { name: n, age } = user; // pull fields out
const copy = { ...user, admin: true }; // shallow copy + extra field
// โโ Functions โโ
function add(a, b = 0) { return a + b; } // default parameter
const mul = (a, b) => a * b; // arrow function
// โโ Control flow โโ
if (x > 0) { } else if (x === 0) { } else { } // === checks type too
for (let i = 0; i < 10; i++) { }
for (const item of list) { } // values
while (x > 0) { x--; }
// โโ Classes โโ
class Animal {
constructor(name) { this.name = name; }
speak() { return `${this.name} makes a sound`; }
}
class Dog extends Animal {
speak() { return "Woof"; } // override
}
// โโ Async / await โโ
const res = await fetch("/api/data");
const data = await res.json();
try { await risky(); } catch (err) { console.error(err); }
// โโ DOM โโ
const el = document.querySelector("#id, .class, tag");
el.addEventListener("click", (e) => { /* ... */ });
el.textContent = "hi"; el.classList.toggle("dark");
// โโ Program skeleton โโ
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
// โโ Variables & types โโ
int n = 42; double d = 3.14; bool ok = true;
char c = 'A'; string s = "hello";
const int MAX = 100; // constant
auto total = n * 2; // compiler deduces type
// โโ Input / output โโ
cout << "Enter a number: ";
cin >> n;
cout << "You typed " << n << endl;
// โโ Control flow โโ
if (n > 0) { } else if (n == 0) { } else { }
for (int i = 0; i < 10; i++) { }
while (n > 0) { n--; }
switch (c) { case 'A': break; default: break; }
// โโ Vectors (dynamic arrays) โโ
vector<int> v = {3, 1, 4};
v.push_back(1); // append
v.size(); v[0]; v.at(0); // .at() bounds-checks
for (int x : v) cout << x; // range-based for
return 0;
}
// โโ Functions โโ
int add(int a, int b = 0) { return a + b; } // default arg
void swapRef(int &a, int &b) { int t = a; a = b; b = t; } // pass by reference
// โโ Classes โโ
class Animal {
public:
Animal(string n) : name(n) {} // constructor + init list
virtual string speak() { return name + " makes a sound"; }
private:
string name;
};
class Dog : public Animal { // inheritance
public:
Dog(string n) : Animal(n) {}
string speak() override { return "Woof"; }
};
// โโ Pointers & references โโ
int x = 5;
int* p = &x; // p holds the address of x
*p = 7; // dereference: x is now 7
int& r = x; // reference: alias for x
// โโ Compile & run โโ
// g++ -std=c++17 main.cpp -o main && ./main
# โโ Variables & types (dynamic) โโ
n = 42; pi = 3.14; ok = True; s = "hello"
type(n) # <class 'int'>
# โโ f-strings โโ
name = "Justin"
print(f"Hello {name}, 1 + 2 = {1 + 2}")
# โโ Lists, tuples, dicts, sets โโ
nums = [3, 1, 4]
nums.append(1); nums.sort(); len(nums)
point = (3, 4) # tuple: immutable
user = {"name": "J", "age": 30} # dict
user["name"]; user.get("email", "n/a")
seen = {1, 2, 3} # set: unique items
# โโ Slicing โโ
nums[0] nums[-1] nums[1:3] nums[::-1] # last one reverses
# โโ Control flow (indentation matters!) โโ
if n > 0:
...
elif n == 0:
...
else:
...
for x in nums: print(x)
for i, x in enumerate(nums): ... # index + value
while n > 0: n -= 1
# โโ Comprehensions โโ
squares = [x**2 for x in range(10) if x % 2 == 0]
lookup = {x: x**2 for x in range(5)}
# โโ Functions โโ
def add(a, b=0, *args, **kwargs):
"""Docstring: what this function does."""
return a + b
# โโ Classes โโ
class Animal:
def __init__(self, name):
self.name = name
def speak(self):
return f"{self.name} makes a sound"
class Dog(Animal): # inheritance
def speak(self):
return "Woof"
# โโ Files & errors โโ
with open("data.txt") as f: # auto-closes the file
text = f.read()
try:
risky()
except ValueError as e:
print(e)
# โโ Run โโ
# python3 script.py
# venv: python3 -m venv .venv && source .venv/bin/activate
<!-- โโ Page skeleton โโ -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Page title</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<!-- โโ Text โโ -->
<h1>Heading 1</h1> ...down to h6
<p>Paragraph with <strong>bold</strong>, <em>italic</em>, <code>code</code></p>
<a href="https://example.com" target="_blank">Link</a>
<img src="photo.jpg" alt="Describe the image" width="300">
<!-- โโ Lists & tables โโ -->
<ul><li>Bullet item</li></ul>
<ol><li>Numbered item</li></ol>
<table>
<tr><th>Header</th></tr>
<tr><td>Cell</td></tr>
</table>
<!-- โโ Semantic layout (use instead of div where possible) โโ -->
<header> <nav> <main> <section> <article> <aside> <footer>
<!-- โโ Forms โโ -->
<form action="/submit" method="post">
<label for="email">Email</label>
<input type="email" id="email" name="email" required>
<input type="checkbox"> <input type="radio"> <input type="number">
<select><option>One</option></select>
<textarea rows="4"></textarea>
<button type="submit">Send</button>
</form>
<script src="app.js"></script>
</body>
</html>
/* โโ Selectors โโ */
p { } /* every <p> element */
.card { } /* class="card" */
#main { } /* id="main" */
.card > p { } /* direct child only */
.card p { } /* any descendant */
a:hover, input:focus, li:first-child { } /* pseudo-classes */
/* โโ Box model (outside โ in: margin, border, padding, content) โโ */
.box {
margin: 16px; /* space outside the border */
border: 1px solid #ccc;
padding: 12px; /* space inside the border */
box-sizing: border-box; /* width includes padding + border */
}
/* โโ Flexbox: one-dimensional layout โโ */
.row {
display: flex;
justify-content: space-between; /* main axis */
align-items: center; /* cross axis */
gap: 12px;
flex-wrap: wrap;
}
/* โโ Grid: two-dimensional layout โโ */
.grid {
display: grid;
grid-template-columns: repeat(3, 1fr); /* three equal columns */
gap: 16px;
}
/* โโ Positioning โโ */
/* static (default) ยท relative ยท absolute ยท fixed ยท sticky */
.badge { position: absolute; top: 0; right: 0; }
/* absolute positions against the nearest non-static ancestor */
/* โโ Custom properties (variables) โโ */
:root { --brand: #2ecc71; }
.btn { background: var(--brand); }
/* โโ Responsive โโ */
@media (max-width: 640px) {
.row { flex-direction: column; }
}
/* โโ Units โโ */
/* px fixed ยท % of parent ยท rem multiple of root font size ยท vw/vh % of viewport */
CS Quick Reference
Big-O complexities, powers of two, and ASCII landmarks, handy for exams and interviews.
Data Structure Operations (average)
| Structure | Access | Search | Insert | Delete |
|---|---|---|---|---|
| Array | O(1) | O(n) | O(n) | O(n) |
| Linked List | O(n) | O(n) | O(1) | O(1) |
| Stack / Queue | O(n) | O(n) | O(1) | O(1) |
| Hash Table | n/a | O(1) | O(1) | O(1) |
| Binary Search Tree | O(log n) | O(log n) | O(log n) | O(log n) |
| Heap | n/a | O(n) | O(log n) | O(log n) |
Sorting Algorithms
| Algorithm | Best | Average | Worst | Space |
|---|---|---|---|---|
| Bubble Sort | O(n) | O(nยฒ) | O(nยฒ) | O(1) |
| Insertion Sort | O(n) | O(nยฒ) | O(nยฒ) | O(1) |
| Merge Sort | O(n log n) | O(n log n) | O(n log n) | O(n) |
| Quick Sort | O(n log n) | O(n log n) | O(nยฒ) | O(log n) |
| Heap Sort | O(n log n) | O(n log n) | O(n log n) | O(1) |
| Binary Search | O(1) | O(log n) | O(log n) | O(1) |
Powers of Two
| Power | Value | Note |
|---|---|---|
| 2โด | 16 | one hex digit |
| 2โธ | 256 | 1 byte |
| 2ยนโฐ | 1,024 | 1 KiB |
| 2ยนโถ | 65,536 | 2 bytes / ports |
| 2ยฒโฐ | 1,048,576 | 1 MiB |
| 2ยณโฐ | 1,073,741,824 | 1 GiB |
| 2ยณยนโ1 | 2,147,483,647 | max signed int32 |
| 2ยณยฒ | 4,294,967,296 | IPv4 space |
| 2โถโด | โ 1.8 ร 10ยนโน | max uint64 + 1 |
ASCII Landmarks
| Char | Dec | Hex | Note |
|---|---|---|---|
| NUL | 0 | 0x00 | string terminator (C) |
| \n (LF) | 10 | 0x0A | newline |
| space | 32 | 0x20 | first printable |
| '0' | 48 | 0x30 | digits 48โ57 |
| 'A' | 65 | 0x41 | uppercase 65โ90 |
| 'a' | 97 | 0x61 | lowercase 97โ122 ('A' + 32) |