Snippet Catalogue

Curated and community verified programming code passages ready for practice.

typescriptbeginner

TypeScript Basic Calculator

Simple typed arithmetic function with validation

110 chars · 6 lines
typescriptadvanced

TypeScript Generic LRU Cache

High-performance O(1) doubly linked LRU eviction cache

910 chars · 42 lines
typescriptintermediate

React useDebounce Custom Hook

Generic debounce hook with cleanup timer in TypeScript

337 chars · 16 lines
javascriptbeginner

Group Array by Key

Reducer pattern to group a collection of objects by a property

239 chars · 10 lines
pythonbeginner

Fibonacci Yield Generator

Memory-efficient Python generator yielding Fibonacci numbers

135 chars · 7 lines
pythonadvanced

Async Connection Lock Context

Thread-safe asynchronous resource lease with exception cleanup

367 chars · 13 lines
rustintermediate

Rust Port Parser with Result

Robust configuration value parsing using Rust Result and match

261 chars · 7 lines
gointermediate

Go Worker Goroutine Channel

Bounded concurrent worker reading jobs and sending results

137 chars · 7 lines
cbeginner

C Linked List Push Front

Dynamic memory allocation and pointer rebinding in C

295 chars · 14 lines
cppadvanced

C++ Thread-Safe Queue Push

Modern C++ std::lock_guard with condition variable notification

355 chars · 17 lines
javaintermediate

Java Stream Collector Grouping

Filter and collect transaction totals by currency using modern Java Streams

472 chars · 16 lines
phpbeginner

PHP 8 Enum and Match Expression

Clean status enum with exhaustive match return expression

384 chars · 14 lines
htmlbeginner

Native HTML Dialog Element

Standard accessible modal dialog markup with semantic forms

341 chars · 11 lines
cssintermediate

Responsive CSS Grid with MinMax

Fluid responsive auto-fit grid layout without media queries

295 chars · 14 lines
sqlintermediate

SQL Window Function with CTE

DENSE_RANK partition query ranking top typists per language

307 chars · 14 lines
bashbeginner

Bash Timestamped Tar Archive

Safe shell script with exit on error and timestamped gzip archive

319 chars · 13 lines
typescriptexpert

Express Typed Rate Limit Middleware

In-memory token bucket rate limiter middleware in Express/TypeScript

712 chars · 27 lines
typescriptintermediate

Next.js Typed Server Action

Server Action with revalidatePath and safe response schema in Next.js

541 chars · 22 lines
typescriptintermediate

Vue 3 Composition API Composable

Ref, computed, and reactive state management in Vue 3

367 chars · 17 lines
typescriptintermediate

Svelte 5 Universal State Rune

Modern Svelte 5 $state and $derived reactive typing

279 chars · 16 lines
typescriptadvanced

NestJS Injectable Auth Service

NestJS injectable service with constructor injection and async validation

467 chars · 13 lines