Linear Regression Least Squares Fit
Fit a least-squares line to x/y points and return slope, intercept, R-squared and a prediction function with validation.
Page 12 of 14
Fit a least-squares line to x/y points and return slope, intercept, R-squared and a prediction function with validation.
Parse Link headers into URLs, relation arrays and typed parameters, handling quoted commas, relative references and multiple links.
Find the longest strictly increasing subsequence in O(n log n) and return its length, values and original indices.
Split an integer cent total across weighted shares with the largest remainder method so every cent is assigned exactly once.
Calculate a simple moving average over a fixed window with a rolling sum, validating window size and numeric values.
Build multipart/form-data request bodies with custom boundaries, text fields and binary file parts without a browser.
Remember missing lookup results for a short TTL to avoid repeated expensive calls while distinguishing hits from misses.
Build RFC 8288 Link headers for paginated APIs with self, first, previous, next and last relations and validated page bounds.
Compute percentiles and quantiles with linear interpolation on a copied sorted array, validating bounds and numeric input.
Run async tasks by priority with bounded concurrency, unique ids and age-based promotion so low-priority work still completes.
Coordinate async readers and writers with a writer-preferring lock that releases exactly once and exposes waiter counts.
Validate post-login redirect targets against allowed hosts and protocols to block open redirect and credential tricks.
Round finite numbers to a bounded number of decimal places using exponent shifting, then format with fixed digits.
Match Express-style route patterns and infer parameter names as a TypeScript union, including named wildcards and percent decoding.
Parse untrusted JSON without exceptions by returning a discriminated Result, with an optional type-predicate validation layer.
Make untrusted upload names safe by stripping paths, control characters, reserved names and dangerous extensions.
Hash passwords with scrypt, a random salt and explicit cost parameters, then verify them with a timing-safe comparison.
Produce reproducible pseudo-random numbers with Mulberry32, plus integer range and array pick helpers for deterministic fixtures.
Answer range sum queries and point updates in logarithmic time with an array-backed segment tree and strict bounds validation.
Parse semantic versions and compare major, minor, patch, and prerelease identifiers according to SemVer precedence rules.
Parse semantic versions and test ranges with comparators, caret, tilde, wildcards, hyphen ranges and OR unions.
Hash strings or byte arrays with SHA-256 through Web Crypto and return lowercase hexadecimal suitable for integrity checks.
Enforce per-key request limits over a sliding time window with cost support, retry hints, remaining quota, and expired-entry cleanup.
Quote table and column identifiers for PostgreSQL or MySQL, doubling embedded quote characters and rejecting invalid names.
Turn V8 stack strings into structured frames with function names, file paths, line and column numbers, async and native markers.
Serve fresh entries instantly, return stale values while one background refresh runs, and surface refresh failures without breaking reads.
Compute population or sample standard deviation over validated numbers, with clear errors for insufficient sample sizes.
Use native structuredClone when available and fall back to a cycle-safe deep clone covering dates, regexes, maps, sets and typed arrays.
Define named, typed test cases with duplicate-name checks and run them against an executor, returning pass counts and failures.
Schedule delayed async tasks with priorities, bounded concurrency, cancellation, error isolation, and a drain method that waits for completion.
Order dependency graphs with Kahn's algorithm, deterministic tie-breaking, unknown-dependency checks, and clear cycle detection.
Generate and verify time-based one-time passwords from base32 secrets, with configurable digits, period and HMAC algorithm.
A generic Map with per-entry time to live, lazy expiration on reads, manual sweeping, expiry callbacks and bounded insertion-order eviction.
Parse URL query strings into typed values with reusable string, integer, boolean, list, and enum decoders plus aggregated errors.
Model finite states with typed events, guarded transitions, transition history and clear errors for illegal or rejected moves.
Implement a generic union-find structure with path compression, union by rank, component sizes, and grouped member enumeration.
Split byte chunks into decoded text lines with a TransformStream, enforce a line-size ceiling and collect results type-safely.
Sign and verify webhook payloads with HMAC-SHA256, timestamp tolerance and constant-time comparison to block replay attacks.
Distribute selections across weighted nodes with the smooth weighted round-robin algorithm, keeping interleaving fair without randomness.
Run CPU-bound jobs on a fixed pool of Node worker threads with a task queue, timeouts, crash recovery, and clean shutdown.
Parse WWW-Authenticate challenges and quoted auth parameters, including multiple challenges in one header.
A bounded async queue that applies backpressure to producers when full and drains to consumers without dropping or duplicating items.
A cancellable task runner that stops starting new work on abort and always runs registered cleanup, even when a task throws mid-flight.
A debounce utility that collapses rapid calls into one trailing invocation with flush and cancel support for deterministic tests.
A structural deep clone that handles cycles and shared references without infinite recursion, preserving Maps, Sets, Dates and typed arrays.
A controllable clock that makes timer dependent logic testable without real waiting, and drives pending callbacks in exact order.
A resilient fetch wrapper that retries failed requests with exponential backoff and a jittered cap for unreliable networks.
A shutdown coordinator that stops accepting work, waits for in-flight tasks to settle, and force-cancels whatever remains after a deadline.
An incremental JSON Lines reader that yields parsed records line by line with strict validation and clear errors for malformed input.
A retry policy that stops when the total deadline is reached instead of retrying a fixed count, returning the last error and the attempt log.
A config loader that keeps secret values out of committed files by resolving them from the environment and refusing to read them from disk.
A structured log scrubber that masks known secret keys and bearer tokens before serialization, without mutating the original object.
A counting semaphore that bounds in-flight async tasks with FIFO fairness and a safe release path for pooled resources.
A token bucket limiter that refills at a steady rate, allows bursts up to capacity, and reports allow and deny decisions with a deterministic clock.
A record transformer that keeps row indices and source values in every error, so a failing batch traces back to the exact offending record.
An argument parser that reads flags from the command line and environment with declared precedence, reporting which source supplied each value.
A test sandbox that creates a private temporary directory tree, exposes path helpers, and removes everything even when assertions fail.
A staged data pipeline that runs named stages in order, stops at the first failure, and reports which stage and record index broke.
An atomic file writer that stages to a temporary file in the same directory, fsyncs, and renames so readers never observe partial content.
A chunked file reader that streams a file in bounded memory, handles partial multibyte characters, and reports exact bytes consumed.
An idempotency key store that replays the recorded response for duplicate keys and rejects reuse with a different payload.
A typed retry decorator that retries only transient failures, caps exponential backoff and adds jitter to avoid thundering herds.
A typed environment loader that fails fast on missing or malformed variables instead of surfacing None or wrong types deep in the code.
A command runner that executes binaries with an argument array and no shell, so untrusted values can never be interpreted as shell syntax.
A deadline helper that derives per-step timeouts from one shared budget so a slow first step cannot make later steps exceed the total.
A typed helper that links an AbortSignal to a deadline so in-flight requests are cancelled deterministically and listeners never leak.
A typed circuit breaker that trips after consecutive failures, probes recovery in half open state, and resets after a success streak.
A configuration resolver that merges defaults, file, environment and CLI sources in a declared order and records which source won each key.
A cursor codec that encodes and decodes opaque cursors so API clients never depend on internal offsets or key names.
A test harness that drives retry logic with scripted outcomes and a fake clock, so retry behaviour is verified without real delays.
A startup validator that converts raw environment strings into typed values once and fails with a complete list of problems.
An error classifier that maps thrown errors to retryable or fatal decisions with an explicit reason, so retry policy never guesses from message text.
A dependency free validator for the common JSON Schema subset that reports every violation with its JSON path instead of stopping at the first mismatch.
A generic LRU cache with per-entry TTL that evicts least recently used keys and reports hits, misses and evictions for observability.
A Result union with map, mapErr and andThen combinators that makes error paths explicit and compiler-checked instead of exception driven.
A path resolver that joins untrusted segments onto a base directory and rejects any attempt to escape it via dot dot segments or absolute paths.
A single-flight map that collapses concurrent identical calls into one in-flight request and shares its result with every caller.
A generic event emitter whose event names and payload types are checked at compile time, with a listener cap that prevents unbounded growth.
A boundary parser that validates raw external input once and hands typed, sanitized values to the rest of the program.
Build a command-line tool in Go using Cobra with subcommands, persistent flags, shell completion, help templates, and configuration loading from environment.
Implement CORS middleware in Go with configurable allowed origins, methods, headers, preflight request handling, and credential support for cross-origin API.
Handle multipart file uploads in Go with size limits, MIME type validation, unique filename generation, streaming to disk without buffering entire file, and.
Validate form data in Go using struct tags with the validator package, custom validation functions, nested struct validation, and human-readable error.
Create a gRPC server in Go with protobuf service definitions, interceptor middleware for logging and auth, graceful shutdown, health checks, and reflection.
Make HTTP requests in Go with retry logic, exponential backoff, context-based timeouts, connection pooling, and response decoding to typed structs using.
Create a production-ready HTTP server in Go with middleware chaining, graceful shutdown, request logging, CORS handling, and context-based timeouts. Uses.
Generate and validate JWT tokens in Go using the golang-jwt package with custom claims, token expiration, and middleware for protected HTTP routes. Includes.
Implement JWT authentication flow in Node.js Express with bcrypt password hashing, token signing and verification, refresh token endpoint, and protected.
Build an interactive CLI tool in Node.js using Inquirer for prompts, chalk for colored output, and ora for spinners. Includes command chaining, template.
Handle file uploads in Node.js Express using multer middleware with disk and memory storage strategies, file filtering by MIME type, size limits, and.
Validate form data in Node.js Express using express-validator middleware chains, custom sanitizers, grouped error responses, and conditional validation.
Implement JWT authentication in vanilla JavaScript with token storage in localStorage, automatic token attachment to fetch requests, expiry checking, and.
Implement a cached fetch wrapper in vanilla JavaScript using the Cache API with stale-while-revalidate strategy, request deduplication, and automatic cache.
Build a command-line utility in vanilla JavaScript using process.argv parsing, readline for interactive prompts, chalk-free colored output with ANSI codes,.
Fetch and render remote data with vanilla JavaScript using async/await, AbortController for cancellation, loading state management, and error handling with.
Upload files with vanilla JavaScript using XMLHttpRequest for progress tracking, drag-and-drop support, file type validation, and chunked upload for large.
Validate HTML forms with vanilla JavaScript using the Constraint Validation API. Provides custom error messages, real-time validation on input, and.
Fetch data in Vue 3 using composables with reactive loading states, error handling, automatic refetch on parameter change, and cleanup on component unmount.
Build a file upload component in Vue 3 with drag-and-drop, progress bar, multiple file support, preview thumbnails for images, and automatic upload with.
Build reactive forms in Vue 3 using the Composition API with ref and computed. Includes two-way binding, validation rules, dynamic field generation, and.