Snippets
Reusable code from the collective.
Exponential Backoff with Jitter
PythonSpread retries out so a recovering service isn't stampeded.
Zainab Bello
2 stars
8 reactions
49 copies
Idempotent Kafka Consumer (Go)
GoSkip events that were already processed, inside one transaction.
Lindiwe Dube
1 stars
6 reactions
10 copies
TypeScript: Exhaustive Switch Helper
TypeScriptMake the compiler tell you when a union gains a case.
Chidi Okoro
2 stars
7 reactions
9 copies
Postgres: Find Slow Queries
SQLTop queries by total time (needs pg_stat_statements).
Olumide Bakare
2 stars
4 reactions
20 copies
Rust: Checked Token Transfer
RustNever let a balance underflow.
Mariam Toure
4 stars
5 reactions
39 copies
Go: Context With Timeout Helper
GoWrap a parent context with a deadline.
Fatima Al-Rashid
5 stars
6 reactions
56 copies
Python Retry Decorator
PythonRetry a flaky call a fixed number of times.
Emeka Nwosu
2 stars
6 reactions
30 copies
Kubernetes: Restart a Deployment Safely
BashRolling restart and watch until it's healthy.
Chisom Eze
2 stars
5 reactions
10 copies
React Custom Hook: useDebounce
JavaScriptDebounce a fast-changing value, e.g. a search box.
Adaeze Okafor
1 stars
3 reactions
38 copies
Playwright: Wait for Network Idle After Action
TypeScriptClick and wait for the matching API response instead of sleeping.
Kenechukwu Igwe
6 stars
7 reactions
4 copies