Templates
Ready-to-use code snippets and boilerplate. Copy, customize, and integrate into your projects. All templates are tested and production-ready.
CI/CD
A workflow that updates a folder on your server whenever you push to master. Works for WordPress themes, static sites and small PHP apps.
on:
push:
branches: [master]
jobs:
deploy:
runs-on: ubuntu-latest
Docker
One file to run a Spring Boot API, a React front end and MongoDB together, with a persistent volume and a private network.
services:
mongodb:
image: mongo:7
backend:
build: ./backend
frontend:
build: ./client
PHP
A safe PDO setup (exceptions, real prepared statements, UTF-8) and a one-line helper for parameterised queries.
$pdo = new PDO($dsn, $user, $pass, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_EMULATE_PREPARES => false,
]);
Two functions, requireAuth() and requireRole(), that protect any endpoint in one line and answer with proper 401 and 403 JSON errors.
function requireRole(string ...$roles): array {
$user = requireAuth();
if (!in_array($user['role'], $roles, true)) { ... }
Python
A polite scraper skeleton: session with a user agent, delays between requests, parsing with CSS selectors and CSV output.
for url in urls:
soup = BeautifulSoup(session.get(url, timeout=20).text, 'html.parser')
for item in soup.select('.item'):
writer.writerow(...)
Spring
Gateway configuration that routes /api/* paths to services discovered in Eureka, with load balancing between instances.
routes:
- id: products
uri: lb://product-service
predicates:
- Path=/api/products/**
WordPress
Create a draft post with title, content, excerpt and category from any script or automation tool, authenticated with an Application Password.
curl -X POST https://example.com/wp-json/wp/v2/posts
-u "user:app-password"
-H "Content-Type: application/json"
-d '{"status":"draft", ...}'