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.
C# nuggets
2 nuggets found
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)...