Observable Reactive With Operators
Create a typed observable with map filter and mergeMap operators for reactive stream processing.
Page 4 of 14
Create a typed observable with map filter and mergeMap operators for reactive stream processing.
Implement a typed observer pattern with subject and observer interfaces for type-safe event notification.
Implement optimistic concurrency control with version numbers for conflict-free updates.
Implement an Option type for null safety with map and match for explicit absence handling without null checks.
Implement cursor-based pagination with base64 encode and stable sorting for large dataset navigation.
Create a deferred promise with external resolve and reject for event-driven async coordination.
Implement a bounded async queue with backpressure that blocks producers when full for flow control.
Implement a priority queue with dead letter handling for failed messages after max retries.
Implement a sliding window rate limiter using Redis sorted sets for precise distributed throttling.
Implement a Result type for explicit error handling without exceptions forcing callers to handle both cases.
Coordinate distributed transactions with a saga pattern and compensation functions for rollback on failure.
Stream large responses with backpressure and content-type headers for memory-efficient file serving.
Race a promise against a timeout using AbortSignal for cancellable async operations.
Implement a trie for prefix search and autocomplete with insert search and remove operations.
Create immutable value objects with structural equality and validation for domain-driven design.
Define Zod schemas with transforms for input normalization validation and output type inference.
Find the leftmost position where a sorted array can accept a target using a typed binary search lower bound variant.
Generate a typed Gray code sequence of n bits where consecutive values differ by exactly one bit.
Implement a typed bloom filter with k hash functions for probabilistic membership testing.
Implement a typed binary search tree supporting insert and delete using in-order successor for two-child nodes.
Compute single source shortest paths in a typed weighted graph using Dijkstra with a min heap.
Compute the Levenshtein edit distance between two strings with typed insert, delete, and substitute operations.
Find the shortest path in an unweighted typed graph using BFS with a predecessor map for path reconstruction.
Perform topological sort on a typed DAG using DFS with cycle detection via tri-color marking.
Implement a typed hash table with open addressing and double hashing for collision resolution.
Sort a typed array by building a max heap in place then repeatedly extracting the maximum to the end.
Match a pattern in text using typed KMP with a precomputed failure function for linear time matching.
Solve the 0-1 knapsack problem using typed dynamic programming with a rolling array for space optimization.
Compute the longest common subsequence of two strings using typed dynamic programming with table reconstruction.
Count inversions in a number array using a typed mergesort that counts crossings during the merge step.
Generate all primes up to n using a typed segmented sieve of Eratosthenes for memory efficiency.
Sort a typed array in place using quicksort with median-of-three pivot selection and a generic comparator.
Find all occurrences of a pattern in text using typed Rabin Karp with a rolling hash for O(n+m) average time.
Implement a typed skip list supporting insert, delete, and search with probabilistic level assignment.
Build a typed trie from a word list supporting prefix search and autocomplete suggestions ranked by frequency.
Implement a typed disjoint set union find with path compression and union by rank for near constant amortized time.
Assert that reproducibility-critical environment variables are pinned before a build, failing fast when they are not.
Retry a shell command with exponential backoff and a bounded attempt count, failing loudly when exhausted.
Compute an HMAC-SHA256 tag and compare it in constant time to avoid leaking the secret through timing.
Propagate cancellation and deadlines through a call tree using Go context, so abandoned work stops promptly.
Bound concurrent work by cost using a weighted semaphore, admitting tasks only while capacity remains.
Process a stream of jobs with a fixed number of goroutines, bounded channels and graceful completion.
Cap concurrent async tasks with a promise-based semaphore that queues waiters and releases permits safely.
Propagate a correlation id across async calls with AsyncLocalStorage so every log line carries the request identity.
Parse a single-range HTTP Range header, resolve open ends against a resource size and return a satisfiable byte range.
Keep the first occurrence of each log signature and sample the repeats, cutting volume while preserving new messages.
Interpret a Retry-After header as seconds or an HTTP date and cap the delay before the next retry attempt.
Enforce a per-key request rate limit with a sliding window of timestamps, smoothing the bursts a fixed window allows.
Parse and validate a W3C traceparent header into version, trace id, span id and flags, rejecting malformed values.
Verify a hex HMAC signature over a webhook body with a timestamp tolerance, using constant-time comparison.
Paginate ordered rows by a keyset cursor instead of offset, keeping page cost stable as data grows.
Expose counters and histograms in the Prometheus text exposition format with metric metadata and correct escaping.
Hash passwords with scrypt and a per-user salt, then verify them with a constant-time comparison.
Format Python log records as single-line JSON with extra fields, making logs machine-parsable without losing context.
Decide whether to keep a completed trace from its duration, error status and a fallback sample rate.
Initialize shared configuration exactly once on first use with std OnceLock, avoiding locks after setup.
Map a slice in parallel with Rayon, turning a sequential iteration into work-stealing parallelism.
Update a row only when its version still matches, detecting concurrent modification through the affected row count.
Coordinate concurrent async readers and exclusive writers with a fair, promise-based reader-writer lock.
Topologically sort a dependency graph with Kahn algorithm and detect cycles that make an ordering impossible.
Build a sorted SHA-256 manifest of file contents so unchanged inputs can be skipped and integrity verified.
Record observations into cumulative histogram buckets and interpolate a quantile within the crossing bucket.
Simulate multi-version concurrency control so a transaction reads a consistent snapshot while others commit new versions.
Implement optimistic locking with a version column, returning a typed conflict result when concurrent writers collide.
Generate random inputs for a property test and shrink a failing case to a minimal counterexample.
Parse short options and their arguments with getopts so a shell script exposes a predictable CLI instead of positional guesswork.
Aggregate CSV columns with awk: per-group sums, counts, and computed ratios in one pass over streaming input.
Structure script output with a logger function: level filtering, stderr separation, timestamps, and color-aware terminals.
Turn a header CSV into newline-delimited JSON by streaming rows through awk and jq, preserving the header as field names.
Retry curl against flaky endpoints with retry flags, exponential backoff, and server-side Retry-After header respect.
Script a full container release flow: build with cache pins, tag by digest and git SHA, push, and wait for registry health.
Validate required environment variables upfront with parameter expansion guards, checking formats before any side effects.
Scan a directory tree, sort files by size, and print the largest offenders so disk pressure can be investigated quickly.
Prevent concurrent script runs with flock on a lockfile, distinguishing owner from contenders and timing out politely.
Parse long and short options robustly with getopt, validating required flags, defaults, and positional arguments.
Enforce quality gates with a pre-commit hook running lint and format checks, mirrored by the CI pipeline stages.
Transform JSON on the command line with jq filters, selecting fields, reshaping objects, and aggregating arrays in pipes.
Retry a shell command that may fail transiently, waiting longer between attempts and reporting the last error when all tries are exhausted.
Poll rate-limited APIs politely with sleep pacing, exponential spacing for empty results, and a hard attempt ceiling.
Start scripts with strict mode settings so unset variables, failing commands, and pipe errors stop execution instead of being silently ignored.
Harden shell scripts with set -euo pipefail and an ERR trap, converting silent failures into loud, traceable exits.
Emit log lines with a UTC timestamp, level, and message from one helper, so shell output stays consistent and easy to parse.
Stream growing log files with tail -F and grep pipelines, highlighting patterns and stopping cleanly on signals.
Bound external commands with the timeout utility, distinguishing exit code 124 from genuine failures and retrying on it.
Guarantee resource cleanup on any exit path with traps for EXIT INT TERM, keeping partial work dirs off the filesystem.
Register a trap so temporary files and processes are cleaned up even when the script fails or is interrupted.
Poll a health endpoint until a dependency is ready or a timeout elapses, preventing a start-up script from racing ahead of its services.
Process file batches in parallel with xargs -P and -N, controlling concurrency, preserving order, and capping memory.
Track hot counters with atomic operations instead of mutexes, exporting per-second rates and cumulative values for monitoring.
Parse newline-delimited JSON streams with bufio.Scanner, sizing buffers for long lines and isolating malformed records.
Log every request with chi middleware: request ids, durations, status codes, and route patterns instead of raw paths.
Trip a circuit breaker after consecutive failures, short-circuiting calls during an open period and probing recovery with a half-open state.
Resolve CLI configuration with explicit precedence from flags over environment over config file, with typed defaults and validation.
Derive a context with a deadline so downstream work is cancelled when the caller gives up, and propagate the reason through context errors.
Give outbound HTTP calls hard deadlines with context timeouts, propagating cancellation into DNS, connect, and body read phases.
Query and control Docker containers with the Go SDK, filtering by labels, streaming events, and reporting runtime stats.
Read configuration from environment variables with typed parsing and defaults, validating required fields at startup rather than at first use.
Run parallel HTTP fetches under one errgroup context so the first error cancels siblings and always reclaims goroutines.
Fan out calls to many shards with errgroup SetLimit bounding concurrency, merging partial results even when some shards fail.
Fetch several resources concurrently with errgroup so the first error cancels the rest and the combined call fails fast.