📅 Date Without Time. Time Without Date. Birthday has no time. Alarm has no date. DateOnly and TimeOnly prevent bugs from midnight times, time zones, and meaningless components. 📝 DateOnly Examples // Create DateOnly DateOnly birthday = new DateOnly(1990, 5, 15); DateOnly today = DateOnly.FromDateTime(DateTime.Today); // Parse DateOnly parsed = DateOnly.Parse(“2024-12-25”); // Operations DateOnly tomorrow […]
Day: May 29, 2026
C#: Use Caller Info Attributes for Better Logging Without Reflection
📍 Know Who Called You Logging without caller info is useless. Caller Info Attributes give you file path, line number, member name — at compile time. Zero performance cost. 📝 Basic Usage using System.Runtime.CompilerServices; public static void Log(string message, [CallerFilePath] string file = “”, [CallerLineNumber] int line = 0, [CallerMemberName] string member = “”) { […]
SQL: Use Recursive CTE to Query Hierarchical Data (Employee Trees)
🌳 Self-Joins Are Painful. CTE Makes It Easy. Org charts, categories, comments, folder trees — all hierarchical. Recursive CTEs query parent-child relationships elegantly. 📝 Employee Hierarchy — Table structure CREATE TABLE employees ( id INT PRIMARY KEY, name VARCHAR(100), manager_id INT REFERENCES employees(id) ); — Recursive CTE to get org tree WITH RECURSIVE org_tree AS […]
.NET Core: Use Problem Details for Standardized API Error Responses
📋 RFC 7807 Standard Errors Every API invents its own error format. Problem Details (RFC 7807) standardizes HTTP error responses. Clients understand errors universally. 📝 Enable Problem Details // Program.cs builder.Services.AddProblemDetails(); var app = builder.Build(); app.UseStatusCodePages(); // or app.UseProblemDetails(); // More control // Now 404, 400, 500 errors return RFC 7807 format 🎯 Custom Problem […]
Git: Use Worktrees to Work on Multiple Branches at Once
🌲 Multiple Checkouts, One Repository Need to compare main vs feature branch? Stash not enough? git worktree checks out multiple branches simultaneously. No switching, no stashing. 📝 Basic Worktree # Create worktree for feature branch git worktree add ../project-feature feature-branch # Now you have: # /project (main branch) # /project-feature (feature-branch) # Open both in […]
Ajax: Use Navigator.sendBeacon() for Reliable Analytics on Page Unload
📡 Track User Actions Even When They Leave fetch() on page unload gets cancelled. sendBeacon() sends data asynchronously, survives page close. Perfect for analytics, logging, exit tracking. 📝 Basic Usage // Track page unload window.addEventListener(‘beforeunload’, () => { const data = { event: ‘page_exit’, timeOnPage: performance.now(), url: window.location.href }; const blob = new Blob([JSON.stringify(data)], {type: […]
JavaScript: Use structuredClone() for True Deep Copy of Objects
📦 Finally, True Deep Copy Without Libraries JSON.parse(JSON.stringify()) fails with dates, undefined, functions. structuredClone() handles dates, maps, sets, arrays, nested objects — everything. ❌ JSON Hack (Broken) const obj = { date: new Date(), fn: () => {}, undef: undefined }; const copy = JSON.parse(JSON.stringify(obj)); // date becomes string! // fn and undef are gone! […]
HTML: Use Download Attribute to Force File Download Instead of Opening
📥 Click to Download, Not to Preview PDF opens in browser. Image displays. User right-clicks, “Save as”. download attribute forces download with custom filename. 📝 Basic Usage <!– Download with original filename –> <a href=”/files/report.pdf” download>Download PDF</a> <!– Download with custom filename –> <a href=”/files/report.pdf” download=”Q4_Report_2024.pdf”> Download PDF </a> <!– Image download –> <a href=”image.jpg” […]
CSS: Use Scroll Snap for Smooth, Snap-to-Section Scrolling
📱 Native Scroll Snap — No JavaScript Horizontal carousels, full-page scroll, image galleries — all with CSS scroll snap. No JS, smooth physics, works everywhere. 📝 Full-Page Vertical Scroll Snap .container { scroll-snap-type: y mandatory; overflow-y: scroll; height: 100vh; } .section { scroll-snap-align: start; height: 100vh; } /* HTML structure */ <div class=”container”> <section class=”section”>Page […]
Windows 11: Create God Mode Folder for All Settings in One Place
👑 All Control Panels, One Folder Settings scattered everywhere. God Mode creates a folder with EVERY setting. Administrative Tools, Ease of Access, Network, Personalization — all in one place. 🔧 Create God Mode Folder 1. Right-click on Desktop 2. New → Folder 3. Rename folder to: GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} 4. Press Enter 5. Double-click folder → Contains […]
AI Prompt: Generate Complex Terminal Commands from Plain English
💻 “Find all files modified yesterday” → Terminal Command Can’t remember sed syntax? Awk? Grep flags? AI translates English to shell commands. Stop Googling, start doing. 📝 The Prompt Generate a terminal command (bash/zsh) for: [Describe what you want to do] Requirements: – Use safe flags (no destructive commands unless specified) – Include explanation of […]
Docker: Enable BuildKit for Faster, More Secure Image Builds
⚡ Parallel Builds = 2x Faster Old Docker builds run sequentially. BuildKit runs independent stages in parallel. Skipping unused stages. Secret mount without layers. Game changer. 🔧 Enable BuildKit # Environment variable export DOCKER_BUILDKIT=1 docker build . # Or always enable (add to ~/.docker/config.json) { “auth”: { … }, “features”: { “buildkit”: true } } […]
Kubernetes: Use PodDisruptionBudget to Prevent Service Interruption
🛡️ Don’t Drain All Pods at Once Node draining, cluster upgrades, autoscaling down — they all kill pods. PodDisruptionBudget ensures minimum availability during voluntary disruptions. 📝 PDB Examples # At least 2 pods available at all times apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: app-pdb spec: minAvailable: 2 selector: matchLabels: app: myapp # No more than […]
WordPress: Control Heartbeat API to Reduce Server Load
❤️ Your Admin Is Making Unnecessary Requests WordPress Heartbeat API pings server every 15-60 seconds. On high-traffic admin, this kills performance. Control or disable it. 📝 Reduce Heartbeat Frequency // functions.php add_filter(‘heartbeat_settings’, ‘custom_heartbeat_settings’); function custom_heartbeat_settings($settings) { $settings[‘interval’] = 120; // Change to 120 seconds (default 15) return $settings; } // Disable completely on admin add_action(‘init’, […]
Photoshop: Use Content-Aware Fill to Remove Objects Like Magic
✨ Make Objects Disappear Tourist in background? Unwanted logo? Content-Aware Fill analyzes surrounding pixels and fills selection seamlessly. Like magic eraser. 📝 How To Use 1. Select object to remove (Lasso, Pen, Magic Wand) 2. Edit → Fill (Shift+F5) 3. In dialog: Contents → Content-Aware 4. Opacity: 100% 5. Click OK → Object disappears! For […]
Visual Studio: Use Peek Definition (Alt+F12) Without Leaving Your File
👀 See Code Without Opening New Tabs F12 opens new tab, breaks flow. Alt+F12 (Peek Definition) shows code inline. Edit, navigate, close with Esc. Stay in context. ⌨️ Shortcuts Alt+F12 → Peek Definition (inline view) Shift+Alt+F12 → Peek References (where method is used) Ctrl+Alt+F12 → Peek to Implementation (interfaces) Within peek window: Ctrl+Alt+Home → Promote […]













