MonkeyTips

Những mẹo lập trình ngắn gọn, đã kiểm chứng — kèm code chạy được, sơ đồ và thử thách.
shape
shape
shape
shape
shape
shape
shape
shape

Database Khó

Distributed Locking with Redis: Understanding the Redlock Algorithm

A deep dive into the Redlock algorithm for safe distributed locking across multiple Redis nodes, including failure modes, clock drift, and the fencing token fix.

Redis 7.x
Sơ đồ
6 phút đọc · 60 Đọc tip
DevOps Trung bình

Git Interactive Rebase: Clean Up Your Commit History Before a PR

Learn how to use git rebase -i to squash, reorder, and edit commits so your pull requests tell a clean, reviewable story.

Git 2.40+
Sơ đồ
4 phút đọc · 70 Đọc tip
Database Trung bình

Redis Caching Strategies: Cache-Aside vs Write-Through

Compare cache-aside and write-through caching with Redis, including consistency trade-offs, TTL strategy, and when to use each pattern.

Redis 7.x
Sơ đồ
4 phút đọc · 78 Đọc tip
JavaScript Trung bình

TypeScript Utility Types: Pick, Omit, and Partial Explained

Stop duplicating interfaces for every slightly-different shape. Pick, Omit, and Partial let you derive new types from one source of truth — here's when to reach for each.

TypeScript 5.x
Sơ đồ
3 phút đọc · 67 Đọc tip
Bảo Mật Trung bình

Rate Limiting APIs: Token Bucket vs Sliding Window

Fixed windows let clients burst 2x at the boundary. See how token bucket and sliding window rate limiting actually work, with Redis-backed implementations and the pitfalls that break them in production.

Redis 6.x+ Node 18.x+
Sơ đồ
2 phút đọc · 80 Đọc tip
Next.js Trung bình

Next.js App Router: Server Components vs Client Components

Server Components run only on the server; Client Components hydrate in the browser. See how Next.js App Router renders both, and when to actually reach for 'use client'.

Next 14.x - 15.x React 18.x - 19.x
Sơ đồ
3 phút đọc · 906 Đọc tip
JavaScript Trung bình

Debounce vs Throttle in JavaScript: Control How Often Code Runs

Scroll, resize, and keystroke events fire dozens of times a second. Learn how debounce and throttle rate-limit them — and which one to reach for.

JavaScript ES6+
Sơ đồ
2 phút đọc · 926 Đọc tip
Database Trung bình

Database Indexes: Turn a Full Scan Into an Instant Lookup

See why a query without an index scans every row, how an index turns it into a fast lookup, and how to read EXPLAIN to tell the difference.

SQL ANSI / MySQL 8+
Sơ đồ Thử thách
2 phút đọc · 1,709 Đọc tip
PHP Dễ

Preventing SQL Injection in PHP

Learn essential techniques to protect your PHP applications from SQL injection attacks.

PHP 8.0+
Sơ đồ Thử thách
2 phút đọc · 892 Đọc tip
DevOps Trung bình

Docker Multi-Stage Builds for Smaller Images

Reduce your Docker image size dramatically using multi-stage builds.

Docker 20.10+
Sơ đồ Thử thách
2 phút đọc · 2,054 Đọc tip
PHP Trung bình

PHP 8.4 Property Hooks Explained

Discover the new property hooks feature in PHP 8.4 that provides a cleaner way to add logic to property access.

PHP 8.4
Thử thách
1 phút đọc · 1,258 Đọc tip
Laravel Trung bình

Laravel Query Optimization with Eager Loading

Learn how to optimize database queries in Laravel by using eager loading to prevent N+1 query problems.

Laravel 11.x PHP 8.2+
Sơ đồ Thử thách
2 phút đọc · 1,571 Đọc tip
JavaScript Dễ

JavaScript Async/Await Best Practices

Master async/await in JavaScript with these best practices and common pitfalls to avoid.

JavaScript ES2017+
Sơ đồ Thử thách
1 phút đọc · 1,836 Đọc tip