Skip to content
Timothy Overton
Go back

Hello world: why I'm writing this blog

Tech

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:

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:

ReadingTime.cs
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.


Share this post:

Previous Post
Gentle toasted muesli (high protein, low FODMAP, low salt, nut-free)