I’m excited to share a project I’ve been working on – a “Today I Learned” (TIL) website!
This project actually serves two purposes: first, it’s a place where I can keep track of interesting little coding tidbits I stumble upon. Those things where I’m sure future me is going to want to remember it.
The second reason is that I wanted to learn React and Next.js, and what better way to learn than by building something I’ll actually use? (Spoiler alert: it’s working! I’m actually using it! 🎉)
Is it more fun to build a thing than to use it?
Maybe.
While collecting and organizing my programming discoveries has been great, I’ve found that building the underlying architecture has been surprisingly fun. One of my favorite features is the command-line tool to help add new entries. Here’s the upshot:
- It guides you through a series of questions to set up a new TIL entry
- It automatically creates a properly formatted markdown file
- It validates the content to make sure everything is structured correctly
- It even opens your default editor when it’s done!
Technical bits…
The site is built with:
- Next.js for the framework
- React for the UI components
- Markdown for content
- TypeScript for type safety
- A sprinkle of command-line magic for content management
Here’s what it looks like when I add a new entry:
$ npm run til "Python defaultdict"
? Choose a category: python
? Enter a brief summary: A dictionary type that handles missing keys
? Would you like to select from existing tags? Yes
? Select existing tags: python, datastructures
? Would you like to add custom tags? Yes
? Enter tags: nlp
Created new TIL at: src/content/til/python/python-defaultdict.md
Almost all of this is new to me, but it’s so much fun to dive into a whole new kind of programming that I haven’t really done before. I usually use Python to do software development/data analysis/data viz, so building a website is a pretty big change!
Want to try it yourself? The code is all on GitHub (fair warning though – I am definitely not a JavaScript expert, so maybe don’t use this as an example of best practices 😄).