Code Snippets Library

Production-ready patterns from real-world development projects

Total Snippets: 560
Categories: 45

Academic Tools

2
Academic Citation Parser
citation_parser.py
Multi-style citation extractor supporting APA, MLA, Chicago, Harvard, and IEEE formats with BibTeX generation capability. Extracts both in-text citati...
python 1 deps 5 use cases
Google Scholar Search Scraper
google_scholar_scraper.py
Query Google Scholar via plain HTTP + HTML parsing (no official API) and extract structured metadata for the top result(s): title, authors, venue, yea...
python

Accessibility

15
a11y-pnw-isolates-fixes.tsx
a11y-pnw-isolates-fixes.tsx
typescript
Accessibility Planning Patterns
accessibility-planning-patterns.md
markdown
Accessible Theme Switcher Pattern
accessible_theme_switcher.js
Comprehensive theme switching implementation with accessibility features including screen reader announcements, keyboard navigation, localStorage pers...
javascript 3 deps 5 use cases
AltFlow Pattern: Accessible Alt Text Generation
altflow_accessible_alt_text.py
Professional-grade alt text generation following WCAG accessibility standards. Based on the AltFlow Coze agent pattern. Generates strict, accessible a...
python 3 deps 5 use cases
Accessible Form Pattern with Validation
form-with-validation.html
html
Keyboard Navigation Patterns
keyboard_navigation_pattern.js
Comprehensive patterns for implementing keyboard navigation, including smooth scrolling with offset, focus management, and WCAG-compliant keyboard int...
javascript 2 deps 7 use cases
Link Remediation and Fixing Pattern
link_remediation_pattern.py
Automated pattern for fixing broken links, applying redirects, and updating URLs in HTML and Markdown content. Useful for maintaining large documentat...
python 3 deps 5 use cases
modal-focus-trap-aria-overlay.js
modal-focus-trap-aria-overlay.js
javascript
Non-Invasive FocusTrap via MutationObserver
mutation-observer-focus-trap.js
Attaches a focus trap to a panel/drawer whose open/close state is controlled by a third-party script (or any code you don't want to modify). The Mutat...
javascript
numeric-shortcut-guard-typing-target.js
numeric-shortcut-guard-typing-target.js
javascript
Screen Reader Announcement Patterns
screen_reader_announcements.js
Comprehensive patterns for dynamically announcing content changes to screen readers using ARIA live regions. Essential for accessible SPAs and dynamic...
javascript 2 deps 7 use cases
Skip Links and Landmark Navigation Pattern
skip_links_and_landmarks.html
Comprehensive pattern for implementing skip navigation links and proper HTML5 landmark regions for keyboard and screen reader accessibility.
html 3 deps 6 use cases
Single-Button Theme Cycle Pattern
theme-cycle-single-button.js
Cycles through N themes with one button instead of one button per theme. The button's aria-label always tells screen readers both the current state an...
javascript
Comprehensive URL Validation Pattern
url_validation_pattern.py
Robust pattern for validating, testing, and enriching URLs in web applications, particularly useful for accessibility audits, link checkers, and conte...
python 6 deps 5 use cases
Hex Picker Accessibility Pattern (WordBlocks)
wordblocks-hex-picker-a11y-pattern.md
markdown

Admin Patterns

5
================================================
admin-dashboard.html
html
express-bearer-admin-router.ts
express-bearer-admin-router.ts
typescript
Health Check + Monitor Pattern
health-check-pattern.py
python
Hybrid Process Management — subprocess + systemd
hybrid-process-management.py
python
Service Registry Pattern — Single Source of Truth
service-registry-pattern.py
python

Agent Orchestration

15
Agent Lifecycle Management Pattern
agent_lifecycle_management.py
Comprehensive pattern for managing agent lifecycle from initialization through execution to cleanup. Includes state tracking, validation, cost estimat...
python 4 deps 5 use cases
Citation-aware document generation (PDF + DOCX from agent reports)
citation_aware_document_generation.md
markdown
CitationMonitor: live URL verification across agent outputs
citation_monitor_url_verification.md
markdown
Conditional Orchestrator Pattern
conditional_orchestrator.py
Selects one of many workflow branches at runtime based on a contextual condition value (or a pluggable evaluator callable), then runs the chosen branc...
python
Hierarchical Agent Coordination Pattern
hierarchical_agent_coordination.py
Three-tier hierarchical agent architecture for coordinating multi-agent swarms with parallel execution, synthesis layers, and executive consolidation....
python 4 deps 5 use cases
Hierarchical Drummer/Camina synthesis (three-tier rollup)
hierarchical_drummer_camina_synthesis.md
markdown
Multi-Agent Orchestration Data Models
multi_agent_data_models.py
Structured data classes for multi-agent workflows. Provides type-safe containers for tasks, agent results, synthesis operations, and streaming events....
python 4 deps 6 use cases
Multi-platform bot architecture: shared core + platform adapters.
multi_platform_bot_adapter.py
python
Orchestrator Configuration Dataclasses
orchestrator_config.py
Layered dataclass config for multi-agent orchestrator workflows. A base OrchestratorConfig holds options common to every orchestrator (agent count, co...
python
Parallel Agent Orchestration Pattern
parallel-orchestration-pattern.md
markdown
Parallel Agent Execution with Rate Limiting
parallel_agent_execution.py
Pattern for executing multiple async agents in parallel with semaphore-based rate limiting, timeout handling, and retry logic. Ensures controlled conc...
python 3 deps 5 use cases
phased_workflow_orchestrator.py
phased_workflow_orchestrator.py
python
Multi-Provider Abstraction for Agent Communication
provider_abstraction_pattern.py
Abstract base class pattern for unified LLM provider interface in multi-agent systems. Enables agents to work with any LLM provider (OpenAI, Anthropic...
python 5 deps 5 use cases
Task Decomposition Pattern for Multi-Agent Systems
task_decomposition_pattern.py
Pattern for breaking down complex tasks into specific, actionable subtasks that can be executed independently by specialized agents. Uses LLM-based de...
python 4 deps 5 use cases
task_tool_dispatch_pattern.py
task_tool_dispatch_pattern.py
python

Api Clients

47
Data Fetching Patterns Guide
DATA_FETCHING_PATTERNS_GUIDE.md
markdown
api-gateway-llm-wrapper.ts
api-gateway-llm-wrapper.ts
typescript
ArXiv API Client
arxiv_client.py
Client for searching and retrieving academic papers from arXiv.org with dataclass-based paper representation and multiple search methods.
python 1 deps 6 use cases
Abstract Base Provider Pattern for API Clients
base_provider_pattern.py
Reusable abstract base class pattern for implementing multi-provider API integrations with consistent interfaces. Supports streaming responses, base64...
python 3 deps 5 use cases
batch-profile-enrichment-atproto.ts
batch-profile-enrichment-atproto.ts
typescript
BBC News RSS Client
bbc_news_client.py
Client for fetching news articles from BBC News RSS feeds with support for multiple categories and full article content extraction.
python 2 deps 5 use cases
bluesky-client-to-server-auth-sync.ts
bluesky-client-to-server-auth-sync.ts
typescript
Claude Code Provider (Hybrid Free/Paid LLM Provider)
claude_code_provider.py
A provider that uses Claude Code's own Claude instance when running inside Claude Code (no API key, no per-call cost), and transparently falls back to...
python
Cost-Optimized Model Selection by Query Complexity
cost_optimized_model_selection.py
Intelligent model selection based on query complexity analysis. Routes simple queries to smaller/cheaper models and complex queries to flagship models...
python 2 deps 5 use cases
Daily USD spend kill-switch for an LLM proxy
daily-usd-spend-killswitch.md
markdown
Alpha Vantage Finance API Client
finance_client.py
python
GitHub API Client
github_client.py
python
Hybrid Free/API Provider Pattern
hybrid_free_api_provider.py
Automatically detect execution environment and use free service when available (e.g., Claude Code's built-in instance), fall back to paid API when run...
python 3 deps 5 use cases
Jina Reader Web Scraper
jina_web_scraper.py
Web scraping client using Jina Reader API (r.jina.ai) to extract clean, markdown-formatted text content from web pages. Useful for LLM processing as i...
python 1 deps 5 use cases
Lazy-Loading Provider Factory with Singleton Pattern
lazy_loading_provider_factory.py
Factory for LLM providers with lazy initialization and caching. Avoids importing unused providers, reduces memory footprint, and enables graceful hand...
python 2 deps 5 use cases
LLM Call with Cache + Offline Fallback (WordBlocks)
llm-cache-with-fallback-pattern.md
markdown
LLM tactic-cycling retry for content-filter recovery
llm-tactic-cycling-retry.md
markdown
LLM provider parameter-rejection retry (temperature, etc.).
llm_temperature_rejection_retry.py
python 6 use cases
Location Services Client (MapQuest, WalkScore, Air Quality)
location_services_client.py
Unified client for location-based APIs including geocoding (MapQuest), walkability scores (WalkScore), and air quality data (WAQI).
python 1 deps 5 use cases
MyAnimeList API Client
mal_client.py
python
Manus Task API Client — Custom Header Auth + Async Poll Pattern
manus-task-api-client.py
Client for the Manus LLM API, which uses a task-based (async/poll) model rather than a synchronous completion endpoint. Notable auth pattern: uses a b...
python 2 deps 3 use cases
multi-provider-llm-client.js
multi-provider-llm-client.js
javascript
Multi-Provider API Abstraction Pattern
multi_provider_abstraction.py
A robust pattern for creating provider abstractions that support multiple AI/API services through a unified interface. This pattern uses inheritance a...
python 4 deps 5 use cases
NASA API Client
nasa_client.py
python
News API Client
news_client.py
python
noaa-arcgis-rest-api.py
noaa-arcgis-rest-api.py
python
Open-Meteo browser client — keyless forecast + UV + air quality
open-meteo-browser-client.md
markdown
openfoodfacts-api-pagination.py
openfoodfacts-api-pagination.py
python
OpenLibrary API Client
openlibrary_client.py
python
openstreetmap-overpass-api.py
openstreetmap-overpass-api.py
python
paleobiology-database-api.py
paleobiology-database-api.py
python
Unified LLM Provider Ping Tool
ping_providers.py
python
Multi-Provider Fallback on Recoverable Errors
provider-fallback-on-recoverable-error.md
markdown
Provider Adapter Pattern for Shared Libraries
provider_adapter_pattern.py
Adapter pattern for wrapping shared library implementations with application-specific methods. Maintains conversation history, adds convenience method...
python 2 deps 4 use cases
Runware API Reference (cross-project)
runware-api-reference.md
markdown
ssrf_protected_og_scraper.ts
ssrf_protected_og_scraper.ts
typescript
third-party-session-sync-client.ts
third-party-session-sync-client.ts
typescript
Token-gated provider federation with graceful degradation
token-gated-provider-federation.md
markdown
trpc_blob_upload_bluesky.ts
trpc_blob_upload_bluesky.ts
typescript
unesco-xml-api-parser.py
unesco-xml-api-parser.py
python
NOAA Weather API Client
weather_client.py
python
Multi-Provider Web Search Tool
web_search_tool.py
A single tool wrapper that searches the web via SerpAPI, Tavily, or Brave, auto-selecting whichever provider has an API key configured. Exposes an Ope...
python
Wikipedia API Client
wikipedia_client.py
Client for Wikipedia's API supporting article search, summaries, full content retrieval, and random articles across multiple languages.
python 1 deps 6 use cases
Wolfram Alpha Computational Knowledge Engine Client
wolfram_alpha_client.py
Client for querying Wolfram Alpha's computational knowledge engine with support for multiple response formats (plaintext, image, MathML) and both JSON...
python 1 deps 4 use cases
Wolfram Alpha API Client
wolfram_client.py
python
xAI Grok Vision API Integration Pattern
xai_vision_api_integration.py
Complete pattern for integrating xAI's Grok Vision API for image/video analysis with thorough error handling, base64 encoding, and video frame extract...
python 3 deps 6 use cases
YouTube Data API Client
youtube_client.py
python

Async Patterns

21
Async/Sync Adapter Utilities
async_adapter.py
python
Async Context Managers Pattern
async_context_managers.py
Comprehensive patterns for implementing async context managers (__aenter__/__aexit__) for resource management in async code. Includes patterns for API...
python 3 deps 6 use cases
Async LLM Operations Pattern
async_llm_operations.py
Patterns for handling asynchronous LLM operations including concurrent requests, streaming, rate limiting, and error recovery.
python 4 deps 5 use cases
Serialize lazy creation of a shared resource under async fan-out.
asyncio-singleton-lock.py
python
Background Asyncio Event Loop in Threading
asyncio_background_thread.py
Pattern for running asyncio coroutines in background threads alongside Flask/synchronous applications. This is essential for integrating async WebSock...
python 2 deps 4 use cases
Background Event Loop Manager
background_loop.py
python
cancelled-flag-useeffect-cleanup.ts
cancelled-flag-useeffect-cleanup.ts
typescript
Flask + Asyncio Background Thread Integration
flask_asyncio_background_thread.py
Pattern for running asyncio event loops in background threads alongside Flask applications. Enables async tasks (WebSocket clients, async APIs) to run...
python 3 deps 5 use cases
IframePostMessageBridge — promise-based request/response envelope over postMessage.
iframe-postmessage-bridge-with-timeouts.js
javascript
LLM prepass → overlap downstream gens with full payload
llm-prepass-then-full-overlap.md
markdown
multi-lane-priority-queue-with-abort.js
multi-lane-priority-queue-with-abort.js
javascript
Parallel coding agents with a consensus safety gate
parallel-coding-agents-with-consensus-gate.md
markdown
Parallel Task Execution Pattern
parallel_task_execution.py
Pattern for executing multiple async tasks concurrently with proper error handling, progress tracking, and result aggregation. Demonstrates how to orc...
python 4 deps 5 use cases
pendingRef: Pass Context Across an Async Cascade Without Threading
pending-ref-across-async-cascade.md
markdown
speculative-prefetch-depth-n-tree.js
speculative-prefetch-depth-n-tree.js
javascript
sse-streaming-client.js
sse-streaming-client.js
javascript
Task Cancellation and Timeout Patterns
task_cancellation_timeout.py
Comprehensive patterns for handling async task cancellation, timeouts, graceful shutdown, and cleanup. Includes patterns for cancelling individual tas...
python 3 deps 6 use cases
Task Cancellation and Timeout Utilities
task_management.py
python
ThreadPoolExecutor Concurrent Execution Pattern
threadpool_concurrent_execution.py
Production-ready pattern for executing multiple tasks concurrently using ThreadPoolExecutor with proper error handling, callback systems, and result a...
python 3 deps 6 use cases
useref-for-high-frequency-event-tracking.ts
useref-for-high-frequency-event-tracking.ts
typescript
useref-stale-closure-cleanup.ts
useref-stale-closure-cleanup.ts
typescript

Bipolar Dashboard

3
Multi-Source Data Generator Orchestration
multi-source-data-generator-orchestration.md
markdown
Realistic Content Generation Helpers
realistic-content-generation-helpers.md
markdown
Sine Wave Mood Cycle Pattern
sine-wave-mood-cycle-pattern.md
markdown

Cli Tools

18
Data Distribution Analyzer for Scale Selection
analyze-distribution.py
python
Bash ANSI Cursor Animation Skeleton
bash-ansi-cursor-animation-skeleton.md
markdown
Bash ANSI Modular Effect Library
bash-ansi-modular-effect-library.md
markdown
Bash: Cron + cURL API Automation
bash-cron-api-automation.md
markdown
Snippet: Formatted Terminal Output with Colors and Boxes
bash-formatted-output.md
markdown
Bash: Multi-Platform Skill Sync
bash-multi-platform-skill-sync.md
markdown
Bash: Publish Each Entry from a JSON Manifest
bash-publish-from-json-manifest.md
markdown
Bash Terminal Coordinate Geometry
bash-terminal-coordinate-geometry.md
markdown
Snippet: CLI Output Parsing from Noisy Sources
cli-output-parsing.md
markdown
Color Palette Generator for Data Visualization
color-palette.py
python
cross-platform-date-arithmetic.sh
cross-platform-date-arithmetic.sh
bash
D3.js Visualization Project Scaffolder
d3-scaffold.py
python
arXiv Paper Fetcher
fetch-arxiv.py
python
Git Index Repair Patterns
git-index-repair.md
markdown
Interactive CLI with LLM Integration Pattern
interactive_cli_with_llm.py
Comprehensive pattern for building interactive CLI chat interfaces that integrate with LLM APIs. Supports streaming responses, conversation history, t...
python 5 deps 5 use cases
Multi-Repo Bash Sweep with GitHub Visibility Filter
multi-repo-sweep-public-only.md
markdown
Snippet: Parallel CLI Execution
parallel-cli-execution.md
markdown
Repository Maintenance Patterns
repository-maintenance.md
markdown

Configuration Management

11
asset-manifest-parity-check.sh
asset-manifest-parity-check.sh
bash
Cross-host git-repo parity when one host can't reach the remote
cross-host-git-repo-parity.md
markdown
Cross-runtime precedence ladder (JS + Python must agree)
cross-runtime-precedence-ladder.md
markdown
Dead-letter field detection (storage → wire → renderer)
dead-letter-field-detection.md
markdown
Bump the localStorage key version to unpin a changed default
localstorage-key-version-bump-to-unpin-defaults.md
markdown
Multi-host config sync preserving per-host secrets
multi_host_config_sync.md
markdown
Multi-Source Configuration Pattern
multi_source_config.py
Comprehensive pattern for loading configuration from multiple sources with proper precedence handling. Supports environment variables, config files, C...
python 6 deps 5 use cases
Run a service from its source repo, not a deployed copy
run-service-from-repo-not-a-copy.md
markdown
SPA auth strategy: which pattern fits
spa-auth-strategy-decision-tree.md
markdown
Version-control an /etc config dir and prune its backup pile
version-control-etc-config-and-prune-backups.md
markdown
vite-strict-port-caddy-proxy.js
vite-strict-port-caddy-proxy.js
javascript

Controls

1
Reset Button Pattern for Visualizations
reset-button-pattern.md
markdown

Css

7
Adopt a design system on a legacy page by aliasing its existing CSS vars
design-system-adoption-via-var-aliasing.md
markdown
mobile-responsive-patterns.css
mobile-responsive-patterns.css
css
OKLCH with #hex Fallback (Browser Graceful Degradation)
oklch-with-hex-fallback.md
markdown
Strip dead CSS rules by selector (brace-matched, assertion-guarded)
strip-dead-css-rules-by-selector.md
markdown
Tabs: active-indicator + divider hairline overlap
tab-active-indicator-hairline-overlap.md
markdown
Terminal-green theme (the `dr.eamer.dev/clocks` ASCII look)
terminal-green-theme.md
markdown
Theme variants via body class — single shared CSS, multiple palettes
theme-variants-via-body-class.md
markdown

Data Pipelines

6
Caddy JSON Access Logs to NCSA Combined Log Format
caddy_to_combined.py
Streams Caddy's structured JSON access logs (stdin) and emits NCSA Combined Log Format lines (stdout) suitable for importing into analytics tools like...
python
Multi-Strategy Geocoding with Graceful Degradation
multi-strategy-geocoding.py
python
Notion-export Markdown → HTML (python-markdown)
notion-markdown-to-html.md
markdown
Single-seam canonical → prototype adapter
single-seam-canonical-prototype-adapter.md
markdown
timestamp_based_one_way_sync.sh
timestamp_based_one_way_sync.sh
bash
World Bank API Data Refresh Pattern
world-bank-api-refresh.py
python

Data Processing

17
auto-metadata-generation.py
auto-metadata-generation.py
python
Canonical Key Reconciliation Shim
canonical_key_reconciliation.py
python 3 use cases
Casual Data Annotations Pattern
casual-data-annotations.md
markdown
Data Aggregation and Pipeline Transformation Patterns
data_aggregation_pipeline_patterns.py
Comprehensive patterns for building data processing pipelines including aggregation, grouping, filtering, and multi-stage transformations. Implements ...
python 4 deps 6 use cases
Data Sanitization and Cleaning Patterns
data_sanitization_patterns.py
Comprehensive patterns for sanitizing, cleaning, and normalizing data from various sources including user input, API responses, and file uploads. Incl...
python 5 deps 6 use cases
dataset-quality-validation.py
dataset-quality-validation.py
python
Document Processing Snippets
document-processing.md
markdown
Multi-Format Data Conversion Patterns
format_conversion_patterns.py
Comprehensive patterns for converting data between JSON, YAML, TOML, XML, and CSV formats with proper error handling and validation.
python 7 deps 5 use cases
JSON Narrative Story Format Parser
json_narrative_parser.py
Parse and convert JSON-based interactive narrative formats (similar to Twine and Ink) into runtime-ready data structures for game engines or...
python 3 deps 5 use cases
JSON Validation, Analysis, and Manipulation Patterns
json_validation_patterns.py
Comprehensive patterns for JSON validation, statistical analysis, key extraction, and manipulation without external dependencies (uses only stdlib).
python 3 deps 6 use cases
llm-json-parse-with-regex-fallback.ts
llm-json-parse-with-regex-fallback.ts
typescript
Polars-native dataset profiling with memory caps.
polars-dataset-profiling-at-scale.py
python
Pydantic Data Validation and Schema Patterns
pydantic_validation_patterns.py
Comprehensive patterns for data validation, transformation, and schema generation using Pydantic. Includes input validation, output serialization, and...
python 3 deps 6 use cases
Rolling History Summary from Flat Event Log
rolling-history-summary-from-event-log.md
markdown
Sibling-DB Pattern for Heavy SQLite Loads
sibling_db_heavy_load_sqlite.py
When one SQLite file serves live traffic and a separate dataset needs to be ingested (millions of rows, multi-minute load), write the new dataset into...
python 1 deps 4 use cases
Synthetic Data Generator Pattern
synthetic-data-generator-pattern.md
markdown
Text processing utilities for cleaning, chunking, and summarising content.
text_processing.py
python

Data Visualization

28
Aurora Hover Sync Pattern
aurora-hover-sync.md
markdown
Branch Color Mapping for Tree Visualizations
branch-color-mapping.md
markdown
Canvas Migration Pattern for Large Point Datasets
canvas-migration-pattern.md
markdown
Canvas2D neon-peg glow renderer
canvas2d-neon-peg-glow.md
markdown
Chart.js Responsive Dashboard Patterns with Theme Support
chart-js-responsive-dashboards.js
Complete patterns for creating interactive, themeable dashboards using Chart.js. Includes bar charts, radar charts, bubble charts, and theme switching...
javascript 2 deps 5 use cases
Chronological Visualization Date Assignment Pattern
chronological-visualization-date-assignment.md
markdown
D3.js Force-Directed Network Visualization with Mobile Support
d3-force-network-visualization.js
Complete pattern for creating interactive force-directed graphs showing relationships between entities. Includes mobile touch handling, filtering, too...
javascript 2 deps 5 use cases
D3.js Geographic Point Sampling Patterns
d3-geographic-point-sampling.md
markdown
D3.js Radial Tree Pattern
d3-radial-tree-pattern.md
markdown
D3.js Sankey Flow Diagram Pattern
d3-sankey-flow-pattern.md
markdown
Data Transformation and Utility Functions for Visualizations
data-transformation-utils.js
Comprehensive collection of utility functions for data loading, parsing, formatting, filtering, and state management in data visualization projects. P...
javascript 1 deps 6 use cases
Pattern: Date-Based Radial Positioning for Tree Nodes
date-based-positioning.md
markdown
Pyvis Flask App: Standard Structure
flask-app-structure.md
markdown
Geocoding Cache Pattern for Data Pipelines
geocoding-cache-pattern.md
markdown
leaflet-choropleth-map.js
leaflet-choropleth-map.js
javascript
Non-Linear Time Axis + Wide-Range Magnitude Encoding
nonlinear-time-axis-and-magnitude-encoding.md
markdown
Pattern: Radial Constraint with Clamped Offsets
radial-constraint-pattern.md
markdown
Radial Force Constraint Tuning Pattern
radial-force-constraint-tuning.md
markdown
Snippet: README Generation for Data Visualizations
readme-generation-datavis.md
markdown
French Republican decimal time + equinox-true calendar (JS)
republican-decimal-time-and-calendar.md
markdown
Social Card Generator (Pillow)
social-card-generator-pil.md
markdown
Social Card Meta Tags Pattern
social-card-meta-tags.md
markdown
SVG Performance Sampling Pattern
svg-performance-sampling.md
markdown
Three.js readPixels → ASCII pipeline
threejs-readpixels-to-ascii.md
markdown
Time Markers Overlay Pattern
time-markers-overlay.md
markdown
Interactive Timeline Animation with Projection Capability
timeline-animation-interactive.js
Complete pattern for creating animated timelines showing historical progression with future projections. Includes playback controls, speed adjustment,...
javascript 3 deps 5 use cases
Drift-free UTC clock tick loop (with a11y minute-gating)
utc-clock-tick-loop.md
markdown
Viewport Culling Pattern for Map Visualizations
viewport-culling-pattern.md
markdown

Database Patterns

8
dexie-indexeddb-typed-crud.ts
dexie-indexeddb-typed-crud.ts
typescript
indexeddb-eviction-sentinel.ts
indexeddb-eviction-sentinel.ts
typescript
The NULL-distinct UNIQUE-index footgun (and the deterministic-key fix)
null-distinct-unique-index-dedupe.md
markdown
SQLite Batch Insert Pattern with Progress Tracking
sqlite-batch-insert.py
python
sqlite-online-backup-rotation.sh
sqlite-online-backup-rotation.sh
bash
SQLite WAL Mode Performance Configuration
sqlite-wal-performance.md
markdown
SQLite Simple Connection Pattern for Flask Apps
sqlite_flask_simple_pattern.py
Straightforward SQLite integration for Flask applications that don't require connection pooling. Uses simple connection-per-operation pattern with pro...
python 2 deps 5 use cases
Thread-Safe SQLite Database Operations
sqlite_threading_safe.py
Pattern for using SQLite safely in multi-threaded applications (Flask, SocketIO, etc.). Avoids "database is locked" errors and ensures proper connecti...
python 2 deps 4 use cases

Deduplication

2
File Deduplication Framework
file_deduplication.py
Comprehensive file deduplication system supporting general files, images, and text files with content similarity detection and optional merging.
python 1 deps 5 use cases
Perceptual-hash deduplication against an existing corpus, in pure Pillow.
pillow_ahash_dedup.py
python

Design Systems

7
Snippet: Collapsible Details Pattern (Pure HTML/CSS)
collapsible-details-pattern.md
markdown
Dashboard Variant Design Patterns
dashboard-variant-patterns-2026-02-14.md
markdown
Filing Cabinet Interface Pattern
filing-cabinet-interface.md
markdown
Glassmorphism CSS Design Pattern
glassmorphism-css-pattern.md
markdown
mobile-first-responsive-controls.md
mobile-first-responsive-controls.md
markdown
Snippet: Sidebar UX Restructure Pattern
sidebar-ux-restructure.md
markdown
Typewriter Animation Pattern
typewriter-animation.md
markdown

Error Handling

3
Typed exception hierarchy for LLM providers.
exceptions.py
python
Graceful Import Fallbacks Pattern
graceful_import_fallbacks.py
Robust pattern for handling optional dependencies and providing graceful degradation when imports fail. Enables modules to work in both full-featured ...
python 4 deps 5 use cases
Retry helpers for synchronous and asynchronous callables.
retry_logic.py
python

File Operations

10
base64-datauri-download.js
base64-datauri-download.js
javascript
client-side-file-size-validation.js
client-side-file-size-validation.js
javascript
Comprehensive Document Parser with Graceful Fallbacks
comprehensive_document_parser.py
Production-ready parser for 50+ file formats with comprehensive error handling, optional dependency fallbacks, and metadata extraction. Supports docum...
python 2 deps 15 use cases
Multi-Format Configuration File Loading
config_file_loading.py
Load configuration from multiple file formats (JSON, YAML, .env) with type conversion and graceful error handling. Supports hierarchical loading from ...
python 5 deps 4 use cases
Directory Cleanup Patterns
directory-cleanup-patterns.md
markdown
Dynamic Module Discovery and Loading
module_discovery.py
Discover and load Python modules dynamically from directories. Includes pattern-based discovery, safe module loading with error handling, and filterin...
python 5 deps 5 use cases
Batch Image Optimizer for Web Performance
optimize_images.py
Walk a directory, find oversized raster images, and shrink them by resizing to a max width and re-encoding. PNGs above a hard threshold are converted ...
python
Path Handling Utilities with pathlib
path_handling_utils.py
Modern path manipulation utilities using pathlib.Path for cross-platform compatibility. Includes path resolution, validation, creation, and common ope...
python 3 deps 5 use cases
WLP Format Parser Pattern
wlp-format-parser.py
python
yaml_frontmatter_markdown_parser.py
yaml_frontmatter_markdown_parser.py
python

Geepers Chat Demo

3
Bottom-Anchored Peek Notification
bottom-peek-pill.md
markdown
Cross-Surface Pin Sync (Hex Tile → Magic Panel)
cross-surface-pin-sync.md
markdown
Smart Hex Expansion (Open-Slot Aware)
smart-hex-expansion.md
markdown

Js Test Patterns

1
Blob round-trip through fake-indexeddb in Vitest/jsdom (the {} gotcha)
fake-indexeddb-blob-roundtrip-vitest.md
markdown

Langgraph Patterns

1
LangGraph ReAct Agent Pattern
react_agent_pattern.py
Complete implementation pattern for a ReAct (Reasoning and Acting) agent using LangGraph with configurable LLM, tool binding, and conditional routing.
python 3 deps 5 use cases

Llm Patterns

3
Ollama Safeguard — Policy-Based Content Moderation with Local Ollama + Gradio
app-ollama-safeguard.py
A local, dependency-light clone of a policy-driven safeguard model (in the spirit of openai/gpt-oss-safeguard). Instead of downloading a large model a...
python
Model lifecycle registry: the one place that knows which model IDs are
model_lifecycle.py
python
Rolling continuity "state bible" for long LLM conversations
rolling-continuity-state-bible.md
markdown

Mobile Capacitor

2
capacitor-platform-detection.ts
capacitor-platform-detection.ts
typescript
capacitor-plugin-bridge.ts
capacitor-plugin-bridge.ts
typescript

Patterns

144
Code Snippets: React Configuration Patterns
2025-12-15-react-config-patterns.md
markdown
Reusable Patterns - 2026-01-05 Checkpoint
2026-01-05-checkpoint-patterns.md
markdown
Code Snippets - 2026-01-05 Checkpoint
2026-01-05-checkpoint.md
markdown
App Store archive → upload gotchas (beast, 2026)
app-store-archive-upload-gotchas.md
markdown
Async upstream → local artifact with poll endpoint
async-upstream-to-local-artifact-with-poll.md
markdown
Autosave preserves architecture neutrality during an in-flight council
autosave-preserves-architecture-neutrality.md
markdown
Bearer token in URL hash — shared-secret auth without a login screen
bearer-token-in-url-hash.md
markdown
Pattern: Flask Monolith to Blueprint Extraction
blueprint-extraction-pattern.md
markdown
Build-and-hold: animate a deterministic render by time-slicing its own compute
build-and-hold-deterministic-animation.md
markdown
Build stamp in /health: detecting stale installed PWAs
build-stamp-stale-pwa-reload.md
markdown
Cache-Buster Mismatch Trap (CSS bumped, JS not)
cache-buster-mismatch-trap.md
markdown
Cache + listeners + write-through localStorage — remote pulls trigger React re-renders
cache-listener-write-through.md
markdown
Caddy on_demand TLS permission (Caddy 2.7+)
caddy-on-demand-tls-permission.md
markdown
Merge Canonical + LLM Choices: Dedup by Label, Cap, Distinct Behavior
canonical-vs-llm-choice-merge.md
markdown
Canvas hit-testing via inverse geometry + in-context legend
canvas-lens-probe-and-legend.md
markdown
Pattern: Canonical Capability Registry
capability-registry-pattern.md
markdown
Capacitor 8 → iOS shipping recipe (Vite web app)
capacitor-ios-shipping-recipe.md
markdown
Pattern: Compaction with Re-Attachment
compaction-reattachment-pattern.md
markdown
Composite graph keys when same surface form appears in multiple languages
composite-graph-keys-for-same-spelled-nodes.md
markdown
Consensus-of-Four: adversarial review process
consensus-of-four-adversarial-review.md
markdown
Content Safety Classifier — SSE Buffer Split + Verdict Extraction Pattern
content-safety-classifier-sse-pattern.md
markdown
Context Pill + editingTarget: visible LLM scope bias
context-pill-and-editing-target-for-llm-scope.md
markdown
Server-wide credential-leak sweep
credential-leak-server-sweep.md
markdown
Cross-platform shell gotchas when diffing/syncing over SSH
cross-platform-shell-gotchas-ssh-sync.md
markdown
Cross-repo contract drift gate (copy + checksum manifest + sibling test)
cross-repo-contract-drift-gate.md
markdown
Cynic's binding dissent overriding external consensus
cynic-binding-dissent-over-external-consensus.md
markdown
Data-attribute theme cycle with CSS custom properties
data-attribute-theme-cycle.md
markdown
Dataset divergence composite score
dataset-divergence-composite-score.md
markdown
Date-seeded "X of the day" picker.
date-seeded-word-of-day.js
javascript
Debounced server sync with local-storage fallback
debounced-server-sync-with-local-fallback.md
markdown
Declarative Tray API with `[data-tray-section]` Buttons
declarative-tray-with-data-attribute-buttons.md
markdown
Default-off opt-in flip with localStorage backward-compat
default-off-opt-in-localstorage-flip.md
markdown
Degenerate-result rejection at the backend boundary.
degenerate-result-rejection.py
python
Design-spec "pixel-perfect" clause admits two readings
design-spec-pixel-perfect-clause-two-readings.md
markdown
Diff-acknowledgment prompt rule for LLM-driven branching narratives
diff-acknowledgment-prompt-rule.md
markdown
Dual time-zone display: render the same instant in two zones
dual-timezone-display-via-intl.md
markdown
Pattern: Durable System Prompt Instructions
durable-system-prompt-instructions.md
markdown
Pattern: Execution Spine Event Model
execution-spine-event-model.md
markdown
Pattern: Fail-Closed Shell Command Analysis
fail-closed-shell-command-analysis.md
markdown
Fail-open LLM pipeline with errors-as-data
fail-open-insight-pipeline.md
markdown
FastAPI CORS Security Pattern
fastapi-cors-security.md
markdown
FastAPI User Feedback System Pattern
fastapi-user-feedback-system.md
markdown
Fastlane: metadata-only uploads + device-prefix screenshot staging
fastlane-deliver-screenshot-staging.md
markdown
Tiny in-process job runner for Flask
flask-inmemory-job-runner.md
markdown
Flask Input Validation Pattern
flask-input-validation.md
markdown
Prefix-aware Flask under Caddy `handle_path`
flask-reverse-proxy-script-name.md
markdown
Font scale accessibility control
font-scale-a11y-control.md
markdown
`@functools.cache` singleton factory
functools-cache-singleton.md
markdown
git-filter-repo-key-scrub.md
git-filter-repo-key-scrub.md
markdown
Pattern: Git Log as Structured Status Feed
git-log-structured-status-feed.md
markdown
GitHub 100 MB-per-file limit: when binary assets exceed it
github-100mb-binary-asset-strategy.md
markdown
Global Default + Per-Entity Metadata Override
global-default-with-per-entity-metadata-override.md
markdown
GoatCounter Snippet Injection
goatcounter-snippet-injection.md
markdown
Groupchat Patterns — Harvested 2026-03-06
groupchat-patterns-2026-03-06.md
markdown
Headless Chrome FPS A/B measurement (and the idle-throttle trap)
headless-chrome-fps-ab-measurement.md
markdown
HuggingFace `load_dataset` with streaming fallback
hf-dataset-load-with-streaming-fallback.md
markdown
Pattern: Hook Lifecycle Infrastructure
hook-lifecycle-infrastructure.md
markdown
htm + ESM single-file React app (no build step)
htm-esm-single-file-react.md
markdown
IIFE-wrap classic `<script>` "modules" to avoid top-level const collisions
iife-wrap-classic-script-modules.md
markdown
Interactive seeded to-do list with check, edit, hide, reset, add
interactive-seeded-todo-with-overrides.md
markdown
iOS PWA: Composing safe-area-inset Into Bottom-Anchored Chrome
ios-pwa-safe-area-composition.md
markdown
Leaflet custom "locate me" control
leaflet-custom-locate-control.md
markdown
Snippets: linguistic-api Phase 1 Consolidation
linguistic-api-phase1-consolidation.md
markdown
LLM-backed structured-edit engine with deterministic fallback
llm-backed-structured-edit-engine-with-fallback.md
markdown
Hard timeout on a (possibly hung) LLM call, with deterministic fallback — Flask/WSGI
llm-call-hard-timeout-with-fallback.md
markdown
LLM-emitted condition name guard (fail-open on phantoms)
llm-condition-name-guard-fail-open.md
markdown
LLM Content Guardrails Pattern
llm-content-guardrails.md
markdown
LLM gateway: module-level semaphore + 429 exp-backoff
llm-gateway-concurrency-and-retry.md
markdown
LLM Tool Calling Loop Pattern
llm-tool-calling-loop.md
markdown
Pattern: Memory with Path-Scoped Rules
memory-path-scoped-rules.md
markdown
Merge ranked lists from N sources, dedup, sort by priority + score
merge-ranked-sources-with-priority.md
markdown
Pattern: Multi-Source Drift Detection
multi-source-drift-detection.md
markdown
Pattern: Named-Array → Lookup Map Helper
named-array-lookup-helper.md
markdown
@Observable settings with UserDefaults write-through (no Combine)
observable-userdefaults-settings.md
markdown
Ollama "local" sentinel for keyless BYOK
ollama-local-sentinel-byok.md
markdown
Open-mode trusted-pair: dropping auth when the URL is the access boundary
open-mode-no-auth-trusted-pair.md
markdown
Package Independence Test
package-independence-test.md
markdown
Pattern: Parallel-Scaffold Blueprint Migration
parallel-scaffold-blueprint-migration.md
markdown
Partial-column-coverage surface-form fallback with per-row match_mode
partial-column-coverage-matchmode-fallback.md
markdown
Patch-id subset check for branch safety
patch-id-subset-check-for-branch-safety.md
markdown
Per-theme WCAG contrast locked in by unit tests
per-theme-wcag-contrast-test.md
markdown
Per-Turn Rule Prepend: surviving long-system-prompt drift
per-turn-rule-prepend-for-llm-drift.md
markdown
Snippet: Periodic Repo Hygiene Sweep
periodic-repo-hygiene.md
markdown
Raspberry Pi touchscreen kiosk on labwc/Wayland (systemd + Chromium)
pi-labwc-chromium-kiosk.md
markdown
Pillow Dynamic Card Renderer Pattern
pillow-dynamic-card-renderer.md
markdown
Pillow PNG-thumb → JPEG sweep, bomb-safe
pillow-thumb-sweep-png-to-jpeg.md
markdown
Pattern: Plugin Enablement Precedence
plugin-enablement-precedence.md
markdown
Minimalist Data Poem: authoring pattern
poem-authoring.md
markdown
pre-commit-untracked-secret-audit.md
pre-commit-untracked-secret-audit.md
markdown
Pattern: Prompt Boundary Splitting
prompt-boundary-pattern.md
markdown
Prose-Diff Above the JSON: making an op-based contract readable
prose-diff-for-op-proposals.md
markdown
Pattern: Provider Gateway Normalization
provider-gateway-normalization.md
markdown
Provider-Spec table collapse for multi-provider HTTP APIs
provider-spec-table-collapse.md
markdown
Snippet: Public Repo Cleanup Workflow
public-repo-cleanup-workflow.md
markdown
PWA Icon Generator: SVG → Raster PNGs With Maskable Variants
pwa-icon-generator-from-svg.md
markdown
PWA Rich Android Install Dialog Requirements
pwa-rich-android-install-dialog.md
markdown
PWA → iOS via xcodegen + WKWebView (bundled assets)
pwa-to-ios-bundled-wkwebview.md
markdown
PWA → iOS phone UX checklist
pwa-to-ios-phone-ux-checklist.md
markdown
Pattern: Reconstruct `.py` Source from `.pyc` Bytecode
pyc-to-py-source-reconstruction.md
markdown
Python Specific Exception Handling Pattern
python-specific-exception-handling.md
markdown
Pattern: Recovery from Context Overflow and Failures
recovery-patterns-context-overflow.md
markdown
Redacted LLM error hints in UI
redacted-llm-error-hint.md
markdown
Migrate CDN-hosted thumbnails to local without re-downloading
regenerate-thumbnails-from-existing-fulls.md
markdown
Pattern: Registry-Driven Artifact Generation
registry-artifact-generators.md
markdown
Pattern: Remote Tool Caching
remote-tool-caching.md
markdown
Schema-Driven Form Renderer with Target Descriptors
schema-driven-form-renderer.md
markdown
Scrub-not-reimport when derived data has drifted from source-of-truth
scrub-not-reimport-when-derived-data-drifted.md
markdown
Self-healing LLM authoring pipeline
self-healing-llm-authoring-pipeline.md
markdown
Shell-adapter monkey-patch-render pattern
shell-adapter-monkey-patch-render.md
markdown
Sidecar markdown notes
sidecar-markdown-notes.md
markdown
Single-file canonical nav for static + Flask multi-page sites
single-file-canonical-nav.md
markdown
Single-user server-JSON persistence
single-user-server-json-persistence.md
markdown
Pattern: Skills as Executable Specs
skills-as-executable-specs.md
markdown
SSH probe via stdin-fed bash
ssh-stdin-fed-bash-probe.md
markdown
SSH tar-pipe through a relay host
ssh-tar-pipe-through-relay.md
markdown
Detecting Stale CLAUDE.md After Rebuild / Swap Commits
stale-claudemd-after-rebuild-commits.md
markdown
Stale-serve for caches keyed on a fast-rotating revision
stale-serve-rev-keyed-cache.md
markdown
Pattern: Streaming Tool Execution
streaming-tool-execution.md
markdown
Bidirectional subpath-prefix helper for Caddy-mounted services
subpath-prefix-bidirectional.md
markdown
Generative-app core: value types, shareable seeds, off-main render
swift-generative-core-value-types.md
markdown
SwiftUI offscreen snapshot for visual QA of a Canvas view
swiftui-offscreen-face-snapshot.md
markdown
Swiss Design Timeline Component
swiss-design-timeline.md
markdown
Text-Length-Scaled Auto-Advance
text-length-scaled-auto-advance.md
markdown
Text-rolodex attribution pattern
text-rolodex-attribution.md
markdown
Thorny-first rebase conflict ordering
thorny-first-rebase-conflict-ordering.md
markdown
Three-runtime parity contract (Python ↔ JS ↔ Swift)
three-runtime-parity-contract.md
markdown
Three-theme CSS with legacy alias compatibility shim
three-theme-css-with-legacy-aliases.md
markdown
Gerstner waves that stay stable when the water plane follows the camera
threejs-gerstner-follow-cam.md
markdown
Three.js scene-depth pre-pass (packed RGBA8)
threejs-scene-depth-prepass.md
markdown
Tolerant JSON extraction from LLM output
tolerant-llm-json-extraction.md
markdown
Pattern: Topocentric Overlay on a Heliocentric Scene
topocentric-overlay-on-heliocentric-scene.md
markdown
Tree-Merge Cycle Guard
tree-merge-cycle-guard.md
markdown
Pattern: URL-Driven Entry Mode for SPAs
url-driven-entry-mode.md
markdown
useOverrides + InlineEdit — editable-blocks pattern over seeded data
use-overrides-edit-hook.md
markdown
Vanilla bottom sheet with breakpoint reparenting (no duplicate DOM)
vanilla-bottom-sheet-breakpoint-reparent.md
markdown
Vanilla JavaScript State Management Pattern
vanilla-js-state-management.md
markdown
`visibilitychange` → sync on tab focus
visibilitychange-sync-on-tab-focus.md
markdown
Vite + Caddy + wouter — SPA at a non-root sub-path
vite-caddy-subpath-spa-with-wouter-base.md
markdown
Installable PWA served at a subpath (vite-plugin-pwa + Caddy handle_path)
vite-plugin-pwa-installable-at-subpath.md
markdown
Vite PWA: precache `public/` static assets for true offline + the config-shadowing footgun
vite-pwa-offline-static-assets.md
markdown
Brace-balanced wikitext template tokenizer
wikitext-brace-balanced-tokenizer.md
markdown
WKWebView native shell: the hardening delegates
wkwebview-native-shell-delegates.md
markdown
XCUITest screenshot automation for WKWebView apps
xcuitest-webview-screenshot-automation.md
markdown

Process Management

4
cron-auto-disable-pattern.sh
cron-auto-disable-pattern.sh
bash
Disk Space Monitor
disk_monitor.py
Monitors overall disk usage plus a configurable set of high-growth files/directories, logs warnings/criticals when thresholds are exceeded, and persis...
python
port-evicting-start-script.sh
port-evicting-start-script.sh
bash
Process Management System for Multiple Python Services
service-manager-pattern.py
Comprehensive service manager for starting, stopping, monitoring, and auto-restarting Python/Flask services. Includes health checking, log management,...
python 2 deps 4 use cases

Publishing

9
Audit a published package for vendored / secret leaks
audit-published-package-for-vendored-leaks.md
markdown
Snippet: Awesome-List PR Submission Workflow
awesome-list-pr-workflow.md
markdown
Snippet: Bulk GitHub Repository Creation
bulk-github-repo-creation.md
markdown
Snippet: Bulk GitHub Repo Humanize + README Audit
bulk-repo-humanize-audit.md
markdown
HuggingFace Dataset README Generator
generate_hf_readme.py
Generates a HuggingFace-compatible README.md (with YAML frontmatter) for a dataset directory from existing Kaggle-style `dataset-metadata.json`. Use i...
python
Markdown Document Generation
markdown_generator.py
python
Multi-Platform Dataset Publishing
multi-platform-dataset-publishing.md
markdown
Snippet: Multi-Repo Skill Rename Convention
multi-repo-skill-rename-convention.md
markdown
New Public Repo Checklist
new-public-repo-checklist.md
markdown

Python Test Patterns

4
Pattern: HTTP Client Test Fixtures with Realistic Mock Payloads
http-client-mock-conftest.md
markdown
Pattern: Mocking LLM Provider SDK Imports in pytest
llm-provider-mock-pattern.md
markdown
Per-test SQLite isolation for a module-global DB manager (pytest)
pytest-per-test-sqlite-isolation.md
markdown
Pytest Fixtures and Testing Patterns
pytest_fixtures_patterns.py
Comprehensive patterns for writing effective pytest tests including fixtures, mocking, parametrization, and test organization strategies.
python 4 deps 6 use cases

Real Time Dashboards

4
chartjs_socketio_integration.html
chartjs_socketio_integration.html
html
Real-Time Dashboard State Management
dashboard_state_management.py
Pattern for managing dashboard state with thread-safe counters, buffers, and statistics tracking. Optimized for real-time data streams with deque-base...
python 2 deps 5 use cases
Flask-SocketIO Real-Time Broadcasting Pattern
flask_socketio_broadcaster.py
Flask application with SocketIO for real-time bidirectional communication. Demonstrates server-to-client broadcasting, client connection handling, and...
python 4 deps 5 use cases
SocketIO Emission from Background Threads
socketio_emit_from_background.py
Pattern for emitting SocketIO events from background asyncio tasks or threads to update real-time dashboards. Critical for separating data processing ...
python 2 deps 5 use cases

Security

12
API Key Environment Scrub Pattern
api-key-env-scrub.py
Replace hardcoded API keys in Python source files with os.environ.get() lookups. Includes a bulk-scrub utility for auditing a project directory and an...
python 1 deps 3 use cases
Authentication helpers for Flask blueprints.
auth.py
python
Snippet: Public Release Gitignore — FastAPI + SvelteKit Project
blueballs-public-release-gitignore.md
markdown
Caddy `respond 404` regex: blocking server-side files inside a public web root
caddy-respond-404-regex-file-blocking.md
markdown
Lightweight cryptographic helpers (hashing, HMAC, optional symmetric encryption).
crypto.py
python
Pattern: Fail-Closed Shell Command Analysis
fail-closed-shell-analysis.md
markdown
Fail-Closed Shell Command Classifier
shell_analyzer.py
python 3 use cases
sri-cdn-security.md
sri-cdn-security.md
markdown
Subresource Integrity (SRI) for CDN Scripts
sri-hash-cdn-security.html
html
HTML Sanitization Function - XSS Prevention
xss-prevention-escapehtml.js
javascript
xss-prevention-tooltip.md
xss-prevention-tooltip.md
markdown
xss-safe-dom-construction.js
xss-safe-dom-construction.js
javascript

Sentiment Analysis

1
VADER Sentiment Analysis Integration
vader_sentiment_analyzer.py
Simple and effective sentiment analysis using VADER (Valence Aware Dictionary and sEntiment Reasoner), optimized for social media text, short messages...
python 1 deps 5 use cases

Social Media Clients

5
at-protocol-uri-construction.ts
at-protocol-uri-construction.ts
typescript
at_protocol_facet_computation.ts
at_protocol_facet_computation.ts
typescript
Post an image + alt text to Bluesky from the browser — no SDK, no server.
bluesky-browser-post-with-alt.js
javascript
Bluesky / AT Protocol Patterns
bluesky-patterns.md
markdown
Bluesky AT Protocol Client
bluesky_at_protocol_client.py
Complete AT Protocol client for Bluesky social network with SQLite caching, batch processing, rate limiting, and interactive account management.
python 2 deps 4 use cases

Spatial Algorithms

2
hex-grid-smart-spawn.ts
hex-grid-smart-spawn.ts
typescript
inter-cluster-proximity-lines.ts
inter-cluster-proximity-lines.ts
typescript

Streaming Patterns

12
Flask Streaming Proxy for a Vision Chat Completions API
alt_proxy.py
A Flask-based proxy that forwards image-analysis requests to an OpenAI-compatible vision chat completions endpoint (e.g. x.ai Grok Vision, OpenAI GPT-...
python
Anthropic web_search over SSE: typed frames, trailing citations, history sanitization
anthropic-web-search-sse-citations.py
Flask endpoint streaming a Claude response (with the server-side web_search tool enabled) to a browser as Server-Sent Events. Three pieces that are ea...
python 2 use cases
Buffered Tag Parser for Streaming Text
buffered-tag-parser.md
markdown
flask_sse_blueprint_ollama_provider.py
flask_sse_blueprint_ollama_provider.py
python
multi-provider-sse-mixed-yield-normalization.py
multi-provider-sse-mixed-yield-normalization.py
python
Hardened NDJSON→SSE streaming proxy (Flask)
ndjson-to-sse-hardened-proxy.md
markdown
Paragraph-aware streaming buffer for progressive message delivery.
paragraph_stream_buffer.py
python
Per-section unlock state machine for streaming generation UIs
per-section-unlock-state-machine.md
markdown
Section-aware streaming buffer for progressive Telegram delivery.
section_stream_buffer.py
python
Server-Sent Events (SSE) Streaming Pattern
sse_streaming_responses.py
Comprehensive patterns for implementing Server-Sent Events streaming in web applications. Supports both Flask and FastAPI implementations with proper ...
python 4 deps 5 use cases
streamed-json-prefix-extract.js
streamed-json-prefix-extract.js
javascript
Streaming Progress Callback Utilities
streaming_progress_callbacks.py
Safe, composable callback helpers for streaming real-time progress events out of long-running (often async) workflows. Wrap arbitrary user-supplied ca...
python

Telegram Bot Patterns

1
Privacy-Respecting Bot Patterns
privacy-patterns.md
markdown

Telegraph

2
Self-contained Telegraph API client and LLM tool wrapper.
telegraph_llm_tool.py
python
Shared Telegraph publisher with scrambled URLs and page tracking.
telegraph_publisher.py
python

Tool Registration

5
Pattern: Deterministic Tool Pool Assembly
deterministic-tool-pool.md
markdown
MCP HTTP-to-Stdio Bridge
mcp_http_bridge.py
Bridges a local stdio MCP client (Cursor, Codex, Claude Desktop, etc.) to a remote HTTP MCP server. The client speaks JSON-RPC over stdin/stdout while...
python
mcp_stdio_server_pattern.py
mcp_stdio_server_pattern.py
python
Deterministic Tool Pool Assembly
pool_assembler.py
python 3 use cases
Swarm Module Pattern - Dynamic Tool Registration
swarm_module_pattern.py
A comprehensive pattern for creating dynamically discoverable and registerable tool modules. This pattern allows tools to be automatically discovered,...
python 5 deps 5 use cases

Trpc

2
jwt-cookie-context.ts
jwt-cookie-context.ts
typescript
procedure-tiers.ts
procedure-tiers.ts
typescript

Typescript Package Exports

1
SNIPPET: Handling Major Version Dependency Upgrades
dependency-major-version-upgrade.md
markdown

Ui Patterns

22
Additive shell adapter — one app brain, many DOM geometries
additive-shell-adapter-render-monkeypatch.md
markdown
Chat-first editor onboarding affordances (creation lane, prompt deck, mood theming)
chat-first-editor-onboarding-affordances.md
markdown
circle_menu_fanout.html
circle_menu_fanout.html
html
collapsible-presence-activity-panel.tsx
collapsible-presence-activity-panel.tsx
typescript
Confirm-before-speak (never auto-speak generated output)
confirm-before-speak-aac.md
markdown
CSS-variable-driven SVG silhouettes with explicit-fill swatches
css-var-svg-silhouette-with-swatches.md
markdown
DOM-teleport overlay (focus-mode pattern)
dom-teleport-overlay.md
markdown
Focus-trap for modal overlays (vanilla JS)
focus-trap-modal.md
markdown
Host-agnostic mount module pattern
host-agnostic-mount-module.md
markdown
Snippet: Lazy Symbol Loader with IntersectionObserver + MutationObserver
lazy-symbol-loader-intersection-observer.md
markdown
Long-Press Touch Drag vs Canvas Pan
long-press-drag-vs-canvas-pan.md
markdown
mobile-overflow-toolbar.tsx
mobile-overflow-toolbar.tsx
typescript
Multi-store fresh-start coordination
multi-store-fresh-start.md
markdown
Persistent floating "customer-service-bot" chat dock
persistent-floating-chat-dock.md
markdown
Platform-Gated Optional Prop (Hide UI Without Runtime Flags)
platform-gated-optional-prop.md
markdown
Recently-added filter + badge
recently-added-filter.md
markdown
Responsive Horizontal Controls Pattern
responsive-horizontal-controls.md
markdown
Singleton In-Flight Spinner
singleton-in-flight-spinner.md
markdown
Small pixel-art glyphs: hate-symbol hazard + reliable digit/flip patterns
small-pixel-glyph-hazards-and-flip-clocks.md
markdown
Sort dropdown that composes with `[hidden]` filtering
sort-composes-with-hidden-filter.md
markdown
SwiftUI WidgetKit + Canvas: two gotchas that bite
swiftui-widgetkit-canvas-face-gotchas.md
markdown
Web Speech API TTS wrapper (speak / cancel / support-check)
web-speech-tts-wrapper.md
markdown

Utilities

29
ascii-language-detection.ts
ascii-language-detection.ts
typescript
Atomic JSON State Store
atomic_json_state_store.py
Tiny per-key JSON persistence for lightweight process state (last-seen IDs, cursors, offsets, poller checkpoints). Use when a long- running worker nee...
python
Base Class Pattern for Plugin/Tool Architecture
base-class-pattern.py
Extensible base class pattern for building plugin systems, tool libraries, or modular components. Uses Pydantic for validation, abstract methods for e...
python 2 deps 4 use cases
blob-url-lifecycle.js
blob-url-lifecycle.js
javascript
Cache Manager with Redis and In-Memory Fallback
cache_manager.py
Caches responses (e.g. LLM API calls) to save cost and latency. Uses Redis when reachable and transparently falls back to an in-memory dict with TTL e...
python
Cache Manager with Redis and In-Memory Fallback
cache_manager_redis_fallback.py
Production-ready cache manager that uses Redis when available and gracefully falls back to in-memory dict. Includes TTL support, statistics tracking, ...
python 1 deps 5 use cases
Cryptographic Utilities
crypto_utilities.py
Lightweight cryptographic helpers for hashing, HMAC signatures, key derivation, and optional symmetric encryption using Fernet.
python 4 deps 6 use cases
Data validation helpers for lightweight schema enforcement.
data_validation.py
python
Date and Time Utilities
datetime_utilities.py
Production-ready date and time manipulation utilities for parsing, formatting, and working with timestamps, timezones, and human-readable time represe...
python 3 deps 5 use cases
Embedding Generation and Semantic Similarity Pattern
embedding_generation_similarity.py
Production-ready pattern for generating text embeddings and performing semantic similarity search using multiple providers (Ollama, OpenAI). Includes ...
python 3 deps 6 use cases
Environment Configuration Utilities
env_config_utilities.py
Utilities for loading and validating environment variables with type conversion, default values, and required field checking. Essential for 12-factor ...
python 3 deps 5 use cases
ES6 Module Lazy Loading Pattern
es6-lazy-loading-pattern.md
markdown
Flask Image Handling Utilities
flask_image_handling.py
Robust image decoding, validation, and response formatting for Flask vision APIs. Handles both JSON (base64) and multipart form uploads. Eliminates du...
python 3 deps 5 use cases
iOS App Icon + Launch Hero Generator
generate-app-icon.py
Generate every iOS AppIcon.appiconset rendition (and a LaunchHero bitmap) from a single master PNG. Auto-crops the source to the non-white icon bounds...
python
IMAP Inbox Reader
inbox.py
A small, dependency-free IMAPS client for reading messages from a mailbox. Supports fetching unread mail, incremental fetch by UID (poll for new mail ...
python
Logging Utilities
logging_utilities.py
Production-ready logging configurations with structured logging, multiple handlers, log rotation, and context-aware logging for microservices and AI a...
python 5 deps 6 use cases
MailMessage — immutable representation of an email, incoming or outgoing.
message.py
python
Rate limiting utilities for Flask applications.
rate_limit.py
python
Rate Limiting Utilities
rate_limiter.py
Production-ready rate limiting implementations for both synchronous and asynchronous code. Includes semaphore-based concurrency control, token bucket ...
python 5 deps 5 use cases
Redis Cache Manager
redis_cache_manager.py
Production-ready Redis caching utilities with TTL support, semantic caching for LLM responses, rate limiting, and connection pooling. Provides both di...
python 5 deps 5 use cases
Retry Decorator with Exponential Backoff
retry_decorator.py
A production-ready retry decorator that handles transient failures with exponential backoff, configurable exception handling, and comprehensive loggin...
python 4 deps 5 use cases
scan-dir-build-platform-manifests.py
scan-dir-build-platform-manifests.py
python
Service Proxy with Circuit Breaker
service_proxy.py
Wraps HTTP calls to a backend service with resilience logic so a slow or down dependency degrades gracefully instead of hanging your app. Use it in pl...
python
String Manipulation Utilities
string_utilities.py
Comprehensive string manipulation utilities for text processing, sanitization, formatting, and validation. Essential for working with user input, API ...
python 4 deps 6 use cases
Timezone and Duration Utilities with pytz
timezone_and_duration_utilities.py
Comprehensive timezone conversion, time difference calculation, and duration parsing utilities using pytz for production-grade timezone support.
python 2 deps 6 use cases
Text-to-Speech Utilities
tts.py
python
TypeScript: JSON File State Persistence
typescript-json-state-persistence.md
markdown
Same as solver 1, but enforce English sentence flow: rows of active words
wordclock_span_solver.py
python
YouTube Audio Extractor
youtube_audio_extractor.py
python

Vision Patterns

8
Batch Alt-Text Generator for a Directory of Images
alt_gen_master.py
python 4 use cases
Image Cutout Extraction for Parallax Depth Layers
extract_cutouts.py
python 4 use cases
Image operations: type detection, resizing, format conversion, and
image_ops.py
python
Provenance bulk-classify pattern
provenance-bulk-classify.md
markdown
Snippet: Three.js Tooltip Guard Clause
threejs-tooltip-guard-clause.md
markdown
Vision API Client
vision_client.py
Comprehensive vision analysis client for image and video analysis using AI vision models (xAI Grok Vision, OpenAI Vision, etc.) with structured result...
python 3 deps 6 use cases
Vision-LLM enrichment pass that also detects duplicates against a known corpus.
vision_enrich_with_references.py
python
Common patterns for vision-based Flask services.
vision_service.py
python

Web Clocks

15
Accessibility
accessibility.md
markdown
Canvas Animation & Rendering
canvas-animation.md
markdown
Color & Color-Space Math
color.md
markdown
CSS Effects & Tricks
css-tricks.md
markdown
Interaction & Input
interaction.md
markdown
Layout & Responsive Canvas
layout-responsive.md
markdown
Math, Easing & Interpolation
math.md
markdown
Miscellaneous
misc.md
markdown
Numeral Systems & Encoders
numeral-systems.md
markdown
Performance
performance.md
markdown
Physics & Simulation
physics.md
markdown
SVG
svg.md
markdown
Text Rendering
text-rendering.md
markdown
Time Math & Scheduling
time-math.md
markdown
WebGL & Shaders
webgl-shaders.md
markdown

Web Frameworks

39
Audio/Video Feature Quick Start Guide
AUDIO_VIDEO_QUICK_START.md
markdown
Flask + Caddy: Absolute URLs with Path Stripping
absolute-urls-with-path-stripping.md
markdown
Anonymous-then-claim auth via signed owner tokens.
anonymous_owner_token_with_email_claim.py
python 4 use cases
Single-file web-clock patterns (harvested 2026-06-21)
clock-patterns-2026-06.md
markdown
Flask CORS Configuration Helper
cors_config.py
Standardized CORS setup for Flask apps serving a browser/API frontend. Registers flask-cors on your API routes with sensible defaults (credentials, co...
python
Device Pairing → Opaque Bearer Token Auth (web-to-native handoff)
device-pairing-token-auth.md
markdown
Flask + SQLite-WAL versioned KV store — two-writer sync without a database
flask-sqlite-wal-kv-store.md
markdown
Flask Server-Sent Events (SSE) Endpoint Pattern
flask-sse-endpoint.py
Flask implementation for streaming Server-Sent Events responses, perfect for AI text generation, real-time progress updates, and multi-agent systems. ...
python 2 deps 4 use cases
flask-sse-passthrough.py
flask-sse-passthrough.py
python
Flask API Gateway Route Templates
flask_api_gateway_route_templates.py
7 copy-paste templates for building API gateway proxy routes in Flask. Each template handles a different HTTP pattern with proper error handling, vali...
python 3 use cases
Flask Audio File Upload and Processing Handler
flask_audio_file_handler.py
Complete audio file upload, validation, and processing pattern for speech-to-text, text-to-speech, and audio generation workflows.
python 3 deps 4 use cases
Flask Authentication and Authorization Decorators
flask_authentication_decorators.py
Production-ready authentication patterns using decorators for Flask routes. Includes API key validation, JWT tokens, role-based access control, and li...
python 4 deps 6 use cases
Flask Blueprint Organization Patterns
flask_blueprint_organization.py
Comprehensive patterns for organizing Flask applications using blueprints. Demonstrates route organization, service layer pattern, caching decorators,...
python 3 deps 6 use cases
Flask Blueprint with URL Prefix Pattern
flask_blueprint_with_url_prefix.py
Proper Flask Blueprint configuration for hosting applications under a sub-path (e.g., /io/studio, /api/v1). Handles session cookies, static files, and...
python 1 deps 4 use cases
Flask ATTACH DATABASE Read-Only for Cross-SQLite-File Joins
flask_cross_db_attach_readonly.py
Your request handler needs to JOIN data that lives in two sibling SQLite files (e.g. a hot primary DB and a heavy-write atlas DB). You don't want to c...
python 2 deps 4 use cases
Flask Application Factory Pattern with Blueprints
flask_factory_pattern_with_blueprints.py
Production-grade Flask application using factory pattern for testing and configuration flexibility. Demonstrates blueprint organization, caching confi...
python 5 deps 5 use cases
flask-limiter Key Function Scoped by Blueprint
flask_limiter_per_blueprint_key.py
python 3 use cases
flask-limiter behind a reverse proxy: key on the real client IP, not the proxy.
flask_limiter_proxyfix_real_client_ip.py
python
Flask Middleware and Request/Response Hooks
flask_middleware_patterns.py
Comprehensive patterns for Flask middleware using before_request, after_request, and custom middleware classes. Includes analytics tracking, authentic...
python 4 deps 6 use cases
Flask Multi-Provider API Proxy Pattern
flask_multi_provider_api_proxy.py
Production-ready Flask proxy server for multiple AI/LLM providers with comprehensive error handling, rate limiting, CORS configuration, and provider a...
python 5 deps 5 use cases
Flask Multipart File Upload Handler
flask_multipart_file_upload.py
Robust file upload handling with validation, type checking, and error handling. Supports multiple file types and size limits.
python 2 deps 4 use cases
Prefixed LRU+TTL Cache for Multi-Tenant Flask
flask_prefixed_cache_multi_tenant.py
python 4 use cases
Flask-SocketIO Setup for Real-Time Applications
flask_socketio_setup.py
Complete Flask-SocketIO configuration with CORS, threading mode, and proper initialization for real-time bidirectional communication.
python 5 deps 5 use cases
Flask Video Generation and Upload Handler
flask_video_generation_handler.py
Video upload, processing, and generation handler for AI video models and video analysis workflows.
python 3 deps 4 use cases
Gunicorn + Eventlet Deployment Guide for Flask-SocketIO
gunicorn_socketio_deployment.md
markdown
Gunicorn + Eventlet Configuration for Flask-SocketIO Apps
gunicorn_socketio_deployment.py
Production deployment configuration for Flask-SocketIO applications using Gunicorn with eventlet worker class. This pattern enables WebSocket support,...
python 4 deps 5 use cases
Health check utilities for Flask applications.
health.py
python
HTML → Markdown round-trip on contenteditable save.
html_to_markdown_edit_roundtrip.py
python 4 use cases
Idempotent log-on-merge endpoint (buffer-then-patch client)
idempotent-log-on-merge.md
markdown
Loading States and Error Handling Pattern for API Calls
javascript_loading_states_pattern.js
Robust pattern for managing loading states, error handling, and success feedback in frontend applications.
javascript 1 deps 4 use cases
LLM image-gen proxy: subject + style split with style-aware soften retry
llm_image_proxy_subject_style_split.py
python
Common middleware registration utilities for Flask apps.
middleware.py
python
Playwright social-card / OG-image capture from a live page
playwright-social-card-capture.md
markdown
Flask Production Hardening Pattern
production-hardening-pattern.py
python
Quota-guarded speculative prefetch
quota-guarded-prefetch.md
markdown
Caddy: Remove Security Headers for iframe Support
remove-security-headers-for-iframe.md
markdown
Renderless Manager → React Event Bridge
renderless-manager-to-react-event-bridge.md
markdown
Self-registering renderer registry with shape-sniffing (vanilla JS)
self-registering-renderer-registry.md
markdown
Markdown to Telegram HTML converter.
telegram_html_formatter.py
python

Websocket Patterns

3
react-ws-collab-hook.ts
react-ws-collab-hook.ts
typescript
WebSocket Client with Auto-Reconnection
websocket_client_with_reconnect.py
Robust WebSocket client pattern with automatic reconnection, timeout handling, and graceful error recovery. Based on the websockets library for async ...
python 2 deps 4 use cases
WebSocket Firehose Connection with Auto-Reconnection
websocket_firehose_reconnection.py
Robust asyncio-based WebSocket client for consuming real-time data streams (firehoses) with automatic reconnection, timeout handling, and graceful err...
python 2 deps 4 use cases