๐ค $”Hello {name}” is Magic String concatenation is messy. String interpolation ($”) embeds variables directly. More readable, fewer bugs. โ Concatenation string message = “Hello, ” + name + “! You are ” + age + ” years old.”; string sql = “SELECT * FROM users WHERE id = ” + userId; string html = […]
Day: June 7, 2026
C#: Use Tuples to Return Multiple Values from Methods
๐ฆ out parameters are clunky. Tuples are elegant. Need to return multiple values? Tuples return multiple values without creating a class. Named fields, deconstruction, lightweight. โ Out Parameters public void GetUser(int id, out string name, out int age) { name = “Alice”; age = 30; } // Usage GetUser(1, out var name, out var age); […]
SQL: Use ISNULL and NULLIF for Smart NULL Handling
๐ Replace NULL with Default, or Replace Value with NULL ISNULL replaces NULL with default. NULLIF replaces value with NULL. Perfect for data cleaning, division by zero, optional fields. ๐ ISNULL (SQL Server) / IFNULL (MySQL) / COALESCE (Portable) — SQL Server SELECT ISNULL(phone, ‘No phone’) as contact FROM users; — MySQL SELECT IFNULL(phone, ‘No […]
.NET Core: Use Data Annotations for Model Validation
โ Validate Models with Attributes, Not If Statements Manual validation is tedious. Data Annotations validate automatically. Clean models, automatic error messages. ๐ Common Attributes public class User { [Required(ErrorMessage = “Name is required”)] [StringLength(100, MinimumLength = 2)] public string Name { get; set; } [Required] [EmailAddress] public string Email { get; set; } [Range(18, 99)] […]
Git: Use Git Clean to Remove Untracked Files
๐๏ธ Delete Temporary Files Cluttering Your Workspace Build artifacts, logs, temp files โ not in .gitignore yet. git clean removes untracked files. Clean workspace, fresh start. ๐ Basic Clean # Preview what would be deleted (dry run) git clean -n # Delete untracked files (not folders) git clean -f # Delete untracked files and folders […]
Ajax: Add Custom Headers to Fetch Requests
๐ API Keys, Auth Tokens, Custom Headers Some APIs require custom headers. Headers option in fetch adds them. Authentication, content type, custom metadata. ๐ Adding Headers // Basic headers const response = await fetch(‘/api/data’, { headers: { ‘Content-Type’: ‘application/json’, ‘Accept’: ‘application/json’ } }); // Authentication token const token = ‘your-jwt-token’; await fetch(‘/api/protected’, { headers: { […]
JavaScript: Use console.table to Display Arrays as Tables
๐ console.log() is Messy for Arrays Array of objects logs as expandable tree. console.table() displays as formatted table. Much easier to read. ๐ Basic Usage const users = [ { id: 1, name: ‘Alice’, email: ‘alice@example.com’ }, { id: 2, name: ‘Bob’, email: ‘bob@example.com’ }, { id: 3, name: ‘Charlie’, email: ‘charlie@example.com’ } ]; console.table(users); […]
HTML: Use Spellcheck Attribute to Enable Browser Spell Check
โ๏ธ Red Squiggly Lines in Your Textarea Textareas don’t spell-check by default. spellcheck attribute enables browser spell checking. Better user-generated content. ๐ Basic Usage <!– Enable spell check –> <textarea spellcheck=”true” rows=”5″ cols=”50″></textarea> <input type=”text” spellcheck=”true”> <!– Disable spell check –> <input type=”text” spellcheck=”false”> <!– For code editors (disable spell check) –> <textarea class=”code-editor” spellcheck=”false”>function […]
CSS: Use user-select to Prevent Text Selection
๐ซ Stop Users from Selecting UI Elements Double-clicking button selects text. Dragging mouse selects UI labels. user-select prevents accidental selection. Better UX. ๐ Basic Usage /* Prevent selection on entire app */ body { user-select: none; } /* Allow selection on specific elements */ .content { user-select: text; } /* Buttons and UI elements */ […]
Windows 11: Use Snipping Tool for Instant Screenshots
๐ธ Win + Shift + S = Best Screenshot Shortcut Print Screen captures entire screen. Win + Shift + S opens snipping toolbar. Select area, copy to clipboard, paste anywhere. ๐ Modes Win + Shift + S Toolbar options: – Rectangular snip (default) – Freeform snip (draw custom shape) – Window snip (capture specific window) […]
AI Prompt: Generate Recipes from Ingredients You Have
๐ณ “What can I cook with chicken, rice, and bell peppers?” Don’t know what to cook with ingredients on hand? AI generates recipes from your ingredients. No more food waste. ๐ The Prompt I have these ingredients: [list your ingredients here] I also have basic pantry items: salt, pepper, oil, butter, flour, sugar, eggs, milk. […]
Docker: Use Docker Commit to Save Container State as Image
๐พ Made Changes Inside Container? Save Them! You debugged inside container. Installed packages. Now you want to save it. docker commit creates image from running container. ๐ Basic Commit # Start container docker run -it ubuntu bash # Inside container: install packages apt-get update apt-get install -y nginx # Exit (Ctrl+D or exit) # Commit […]
Kubernetes: Use Namespaces to Organize Your Cluster
๐ Virtual Clusters Inside One Physical Cluster All pods in default namespace? Chaos. Namespaces separate environments, teams, or components. Resource quotas, RBAC per namespace. ๐ Create and Use Namespaces # Create namespace kubectl create namespace development kubectl create namespace staging kubectl create namespace production # List namespaces kubectl get namespaces # Run pod in specific […]
WordPress: Understand User Roles and Capabilities for Better Security
๐ฅ Never Give Admin to Everyone Admin has all powers. User roles limit access. Editor writes, Author edits own, Subscriber reads only. Least privilege principle. ๐ Default Roles Administrator: – Full control over site – Add/delete users, install plugins, edit themes – Risk: Can break everything Editor: – Publish and manage all posts/pages – Moderate […]
Photoshop: Use Match Color to Unify Colors Across Photos
๐จ Make All Your Photos Look Like They Were Shot Together Different lighting, different cameras. Match Color transfers color palette from one image to another. Perfect for photo series, product shots. ๐ How to Use 1. Open source image (with desired colors) 2. Open target image (to be adjusted) 3. Select target image 4. Image […]
Visual Studio: Sync Settings Across Multiple Computers
โ๏ธ Your VS Settings Everywhere Theme, keyboard shortcuts, extensions โ setting up a new PC takes hours. VS Settings Sync roams everything. Sign in, done. ๐ง Enable Sync 1. File โ Account Settings 2. Sign in with Microsoft account 3. Tools โ Options โ Environment โ Accounts 4. Check “Synchronize settings across devices” What syncs: […]
C#: Use Switch Expressions Instead of Switch Statements
โก๏ธ switch expression is an expression, not a statement Switch statements are verbose. Switch expressions return values. Less code, fewer bugs, no fall-through. โ Switch Statement string GetGrade(int score) { string grade; switch (score) { case >= 90: grade = “A”; break; case >= 80: grade = “B”; break; default: grade = “F”; break; } […]
C#: Use ^ and .. for Indexing from End and Ranges
๐ arr[^1] is Last Element. arr[1..3] is Range. arr[arr.Length – 1] is verbose. ^ operator indexes from end. .. operator creates ranges. Python-like slicing in C#. โ Old Way var last = arr[arr.Length – 1]; var secondLast = arr[arr.Length – 2]; var slice = arr.Skip(1).Take(3).ToArray(); โ Index and Range var last = arr[^1]; var secondLast […]
SQL: Use COALESCE for First Non-Null Value
๐ COALESCE is NVL2, ISNULL, and IFNULL Combined Need first non-null value? COALESCE takes multiple arguments, returns first non-null. Works across all databases. ๐ Basic COALESCE — Return first non-null SELECT COALESCE(null, null, ‘first’, ‘second’); — Returns ‘first’ SELECT COALESCE(phone, mobile, email, ‘No contact’); — Returns phone if not null, else mobile, else email, else […]
.NET Core: Enable Response Compression for Smaller Payloads
โก 70% Smaller Responses, Same Content JSON responses are text. Text compresses well. Response compression GZIPs responses automatically. Faster downloads, less bandwidth. ๐ Enable Compression // Program.cs builder.Services.AddResponseCompression(options => { options.EnableForHttps = true; options.Providers.Add(); options.Providers.Add(); options.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat( new[] { “application/json”, “text/plain” } ); }); builder.Services.Configure(options => { options.Level = CompressionLevel.Optimal; // Fastest, Optimal, NoCompression […]
Git: Use Cherry-Pick to Apply Specific Commits to Another Branch
๐ Need One Commit from Another Branch? Merge brings all commits. Sometimes you need just one. Cherry-pick applies specific commits to current branch. ๐ Basic Cherry-Pick # Switch to target branch git checkout main # Cherry-pick a commit from feature branch git cherry-pick a1b2c3d # Cherry-pick multiple commits git cherry-pick a1b2c3d d4e5f6g g7h8i9j # Cherry-pick […]
Ajax: Handle Binary Responses (Images, PDFs, ZIPs) with Blob
๐ Download Files via AJAX Fetch JSON is common. What about images? PDFs? ZIPs? Blob responses handle binary data. Create download links dynamically. ๐ Download Image async function downloadImage(url) { const response = await fetch(url); const blob = await response.blob(); const imageUrl = URL.createObjectURL(blob); const img = document.createElement(‘img’); img.src = imageUrl; document.body.appendChild(img); // Clean up […]
JavaScript: Use ?? Instead of || for Default Values
|| treats 0, ”, false as falsy. ?? only checks null/undefined. Default values with || break when value is 0. Nullish coalescing (??) fixes this. Use ?? for default values. โ || (Bug with 0) const volume = userVolume || 50; // If userVolume = 0 โ volume = 50 (WRONG!) const name = userName […]
HTML: Use Autofocus Attribute to Focus Input on Page Load
โจ๏ธ User Can Type Immediately Search page? Login form? User must click input first. autofocus selects input automatically. One less click. ๐ Basic Usage <!– Search page –> <input type=”search” name=”q” autofocus placeholder=”Search…” “> <!– Login page –> <input type=”email” name=”email” autofocus placeholder=”Email”> <!– Modal dialog –> <input type=”text” name=”name” autofocus> <!– Works on any […]
CSS: Use scroll-behavior: smooth for Smooth Page Navigation
๐ Instant Jump is Jarring. Smooth is Better. Anchor links jump instantly. scroll-behavior: smooth animates scrolling. Better UX, no JavaScript. ๐ Basic Usage /* Apply to entire page */ html { scroll-behavior: smooth; } /* Apply only to specific container */ .scroll-container { scroll-behavior: smooth; overflow-y: auto; height: 400px; } /* HTML structure */ <a […]
Windows 11: Press Win + . to Insert Emojis, GIFs, and Symbols Anywhere
๐ Emojis, Kaomoji, Symbols, GIFs โ One Shortcut Need a copyright symbol? An emoji? A GIF? Win + . (period) opens emoji panel everywhere. Browsers, documents, code editors. ๐ What’s Inside Win + . or Win + ; Tabs: – ๐ Emojis (smileys, people, animals, food, activities) – ๐ Kaomoji (Japanese text emoticons) (โโฟโ) – […]
AI Prompt: Write Professional Emails from Bullet Points
โ๏ธ Turn Bullet Points into Professional Emails Don’t know how to phrase that email? AI writes professional emails from your bullet points. Different tones, styles, lengths. ๐ The Prompt Write a professional email with these key points: [Subject]: [email subject] Key points to cover: – [Point 1] – [Point 2] – [Point 3] Recipient: [Colleague […]
Docker: Never Write Logs to Files Inside Containers
๐ Log to stdout/stderr, Not Files Log files inside container fill disk. Container restarts lose logs. Docker captures stdout/stderr. Use docker logs. โ Good vs Bad // โ BAD: Writing to file File.WriteAllText(“/app/logs/app.log”, message); // โ GOOD: Console output Console.WriteLine(message); // โ BAD: Log4Net to file // โ GOOD: Serilog to Console // Docker command […]
Kubernetes: Always Set CPU and Memory Requests and Limits
โ๏ธ No Requests = Unpredictable Scheduling Without resource requests, pods can starve others. Requests and limits ensure fair sharing and prevent resource exhaustion. ๐ Setting Resources apiVersion: v1 kind: Pod metadata: name: myapp spec: containers: – name: app image: myapp:latest resources: requests: memory: “256Mi” cpu: “250m” limits: memory: “512Mi” cpu: “500m” # CPU units: 1000m […]
WordPress: Use RSS Feeds to Display Content on Other Sites
๐ก WordPress has Built-in RSS Feeds for Everything Display posts on other sites, newsletters, or mobile apps. WordPress RSS feeds are ready to use. No plugins needed. ๐ Feed URLs # Main feed (latest 10 posts) https://yoursite.com/feed/ # Category feed https://yoursite.com/category/news/feed/ # Tag feed https://yoursite.com/tag/wordpress/feed/ # Author feed https://yoursite.com/author/admin/feed/ # Search feed https://yoursite.com/?s=keyword&feed=rss2 # Comments […]













