Code Explainers
Browse the library
php
<?php namespace App\Http\Controllers;
Building a multi-step onboarding wizard in Laravel
session-state
validation
multi-step-forms
Intermediate
9 steps
typescript
interface RunningStats { count: number; total: number; average: number;
Streaming running averages in TypeScript
generators
streaming
incremental-aggregation
Intermediate
6 steps
java
package com.acme.catalog.persistence; import jakarta.persistence.Column; import jakarta.persistence.EntityListeners;
Auditing timestamps with a JPA MappedSuperclass in Spring
jpa
auditing
lifecycle-callbacks
Intermediate
5 steps
ruby
require "thread" class ConnectionPool class TimeoutError < StandardError; end
Building a thread-safe connection pool in Ruby
concurrency
resource-pooling
mutex
Advanced
8 steps
javascript
import { createContext, useContext, useReducer, useCallback, useEffect } from 'react'; const AuthContext = createContext(null);
Building an auth context in React
context
usereducer
authentication
Intermediate
8 steps
python
import json import logging import threading from pathlib import Path
A hot-reloading config file watcher
file-watching
thread-safety
hot-reload
Intermediate
7 steps
go
package dedup import ( "hash/fnv"
A rolling Bloom filter deduper in Go
bloom-filter
deduplication
concurrency
Advanced
7 steps
php
<?php namespace App\Http;
HTTP content negotiation in PHP
http
content-negotiation
parsing
Intermediate
9 steps
typescript
import { IsEmail, IsNotEmpty, IsOptional,
How validation groups reuse one DTO in NestJS
validation
dto
decorators
Intermediate
9 steps
rust
use axum::{ extract::{FromRequestParts, Path, Query}, http::{request::Parts, StatusCode}, response::{IntoResponse, Redirect},
Signed download links as an Axum extractor
hmac
custom-extractor
authentication
Advanced
9 steps
java
@Service @RequiredArgsConstructor public class ExchangeRateService {
Request-scoped rate caching in Spring
request-scope
caching
memoization
Advanced
6 steps
php
<?php namespace App\Listeners;
Generating responsive images in a Laravel listener
queued jobs
event listeners
image processing
Intermediate
7 steps
python
class Parser: def __init__(self, text): self.tokens = self._tokenize(text) self.pos = 0
A recursive descent arithmetic parser
recursive-descent
tokenizer
operator-precedence
Intermediate
9 steps
javascript
import { useDeferredValue, useMemo, useState } from "react"; function ProductSearch({ products }) { const [query, setQuery] = useState("");
Keeping search input snappy with useDeferredValue in React
concurrent-rendering
deferred-value
memoization
Intermediate
7 steps
rust
use axum::{ extract::{FromRef, FromRequestParts}, http::{header, request::Parts, StatusCode}, RequestPartsExt,
How a JWT extractor works in Axum
jwt
authentication
extractors
Intermediate
8 steps
typescript
import { InjectionToken, inject, Provider, isDevMode } from '@angular/core'; import { WINDOW } from './window.token'; export interface AnalyticsConfig {
Layered config with an Angular InjectionToken
dependency-injection
configuration
factory-provider
Intermediate
8 steps
ruby
class Admin::AccountsController < Admin::BaseController before_action :set_account, only: :destroy def destroy
A guarded destroy action in Rails
controllers
callbacks
transactions
Intermediate
8 steps
go
package server import ( "net/http"
Rate limiting HTTP handlers with a token bucket
rate-limiting
token-bucket
middleware
Advanced
7 steps