I’ve written bits and pieces on other platforms for a while, and every time I do I’m reminded that I’m renting the space. Layouts change, feeds get reshuffled, and a post you were proud of can quietly disappear. So this site is the home base: my own domain, plain Markdown files in a Git repository, and a static build that should still work in ten years.
What to expect
Mostly software, and mostly the things I actually work with day to day:
- C# and .NET: language features, patterns that have held up, and the mistakes that taught me something.
- Python: usually for prototyping, scripting and automating the boring bits around a .NET system.
- The occasional recipe, because I cook for my family and sometimes a good one deserves to be written down properly.
Here’s the flavour. Every blog needs a “5 min read” label, and working it out is a nice excuse to use a few modern C# features together:
var posts = new List<Post>{ new("Hello world", "I've written bits and pieces on other platforms for a while..."), new("Toasted muesli", "Breakfast can be tricky when little tummies are sensitive..."),};
foreach (var (title, minutes) in ReadingTime.ForAll(posts)) Console.WriteLine($"{title}: {minutes} min read");
public record Post(string Title, string Body);
public static class ReadingTime{ private const int WordsPerMinute = 220;
public static IEnumerable<(string Title, int Minutes)> ForAll(IEnumerable<Post> posts) => posts.Select(p => ( p.Title, Math.Max(1, (int)Math.Ceiling(WordCount(p.Body) / (double)WordsPerMinute))));
private static int WordCount(string text) => text.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries).Length;}Records, tuple deconstruction and a LINQ projection in about twenty lines. The same idea in Python is shorter still:
import math
posts = {"Hello world": "I've written bits and pieces...", "Toasted muesli": "Breakfast can be tricky..."}for title, body in posts.items(): print(f"{title}: {max(1, math.ceil(len(body.split()) / 220))} min read")Where Substack fits
I’ll also publish shorter versions of the tech posts on Substack, which is a good way to reach people who prefer email. Each of those links back here for the full article and the code. The full version always lives on this site first.
If you’d like to follow along, the RSS feed works today. More soon.