Enjoy these free Code Nuggets?
Your support helps us create more high-quality content and unlocks exclusive premium nuggets via a personal activation link.
Support Our Work & Get Exclusive AccessLearn to code with AI, not just about it.
Beyond free snippets, we run hands-on training in AI-assisted coding β teaching developers, teams and beginners how to build real software faster using modern AI tools. You bring the ideas; we show you how to ship them with an AI pair-programmer at your side.
- β Prompting & pairing with AI coding assistants to write, debug and refactor real code
- β Turning plain-English ideas into working apps, scripts and automations
- β Reviewing AI output safely β spotting bugs, security gaps and hallucinations
- β Live cohorts, team workshops and 1-on-1 mentoring β remote or on-site in Kenya
# You describe itβ¦
"Build me a booking form that emails the client."
# β¦the AI drafts itβ¦
βΈ generating form + mailerβ¦
βΈ 24 lines written, 0 errors
# β¦and we teach you to lead it.
β± You stay the engineer. AI is the tool.
All Code Nuggets
45 nuggets found
Powerful, Headless Data Grids with TanStack Table (Premium)
TanStack Table is headless β it gives you sorting, filtering and pagination logic while you keep full control of the markup and styling. Define columns, hand it rows, and render.
import {
useReactTable, getCoreRowModel, getSortedRowModel, flexRender,
} from "@tanstack/react-table";
import { useState } from "react";
const columns = [
{ accessorKey: "name", header: "Name" },
{ accessorKey: "role", header: "Role" },
{ accessorKey: "createdAt", header: "Joined" },
];
e...
Type-safe Routes and Loaders with TanStack Router (Premium)
TanStack Router gives you fully typed routes and data loaders that run before a component renders, so your screen already has its data on first paint β no flash of...
import { createRootRoute, createRoute, Outlet } from "@tanstack/react-router";
const rootRoute = createRootRoute({ component: () => <Outlet /> });
const patientRoute = createRoute({
getParentRoute: () => rootRoute,
path: "/patients/$patientId",
// loader runs before the component mounts
lo...
Extending Microsoft Dynamics 365 Business Central Tables via AL Language
Non-Intrusive Customizations in Business Central using Table Extensions In Microsoft Dynamics 365 Business Central, modifying base source code directly is disallowed. The AL Language utilizes tableextension objects to introduce custom...
tableextension 50100 "CustomerMpesaExt" extends Customer
{
fields
{
field(50100; "M-Pesa Mobile Number"; Text[20])
{
Caption = 'M-Pesa Mobile Number';
DataClassification = CustomerContent;
trigger OnValidate()
var...
Surfacing New Fields with a Page Extension (Premium)
Adding a field to a table does not show it to users. A pageextension places your new fields onto the standard card or list page, anchored next to existing controls.
pageextension 50100 "Customer Card Ext" extends "Customer Card"
{
layout
{
addlast(General)
{
field("Loyalty Points"; Rec."Loyalty Points")
{
ApplicationArea = All;
ToolTip = 'Points earned by this customer.';...
Hooking Business Logic with AL Event Subscribers (Premium)
Event subscribers are how you react to platform actions without touching base code. Subscribe to a published event β like validating a field β and run your own logic when...
codeunit 50100 "Loyalty Events"
{
[EventSubscriber(ObjectType::Table, Database::"Sales Header",
'OnAfterValidateEvent', 'Sell-to Customer No.', true, true)]
local procedure OnValidateCustomer(var Rec: Record "Sales Header")
var
Cust: Record Customer;
begin
if...
Immutable Value Objects with PHP 8.2+ Readonly Properties & Classes
Enforcing True Domain Safety with Native Readonly Classes in PHP 8.2+ PHP 8.2 introduced native readonly class declarations, ensuring that every property cannot be modified after constructor initialization. Domain Validation:...
<?php
declare(strict_types=1);
namespace App\Domain\ValueObjects;
use InvalidArgumentException;
readonly class Money
{
public function __construct(
public int $amountInCents,
public string $currency = 'KES'
) {
if ($this->amountInCents < 0) {
throw new...
Transforming Arrays with map, filter and reduce (Premium)
Loops that build up a result variable are easy to get wrong. PHP's array functions let you describe what you want β transform, keep, or fold β in a single...
$orders = [
['item' => 'Pen', 'qty' => 3, 'price' => 50],
['item' => 'Book', 'qty' => 1, 'price' => 400],
['item' => 'Marker', 'qty' => 5, 'price' => 80],
];
// Only orders worth 200+, as "item: total"
$lines = array_map(
fn ($o) => "{$o['item']}: " . ($o['qty'] * $o['price']),...
Concise Models with Records and Pattern Matching (Premium)
C# records give you immutable data types with value equality in one line. Pair them with switch expressions and pattern matching for branching that stays flat and readable.
public record Shape;
public record Circle(double Radius) : Shape;
public record Rectangle(double Width, double Height) : Shape;
static double Area(Shape shape) => shape switch
{
Circle c => Math.PI * c.Radius * c.Radius,
Rectangle r => r.Width * r.Height,
_...
A Tiny HTTP API with ASP.NET Minimal APIs (Premium)
You do not need controllers and a pile of ceremony to expose an endpoint. Minimal APIs let you map routes to lambdas, wire up dependency injection, and return JSON in...
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IPatientStore, PatientStore>();
var app = builder.Build();
app.MapGet("/patients", (IPatientStore store) => Results.Ok(store.All()));
app.MapGet("/patients/{id:int}", (int id, IPatientStore store) =>
store.Find(id)...