A command-line TIL (Today I Learned) script
I built a simple Ruby script to collect random things I learn throughout the day. It's deliberately minimal—no UI, no database, no dependencies, just a text file and timestamps.
The script lives in my $PATH and works like this:
# Save a new learning
til "You can use git log --oneline --graph for a nice commit tree"
New note gets appended to ~/notes/til.md with a timestamp.
- 2024-12-16 09:12: vim ggVG selects all text
- 2024-12-16 11:30: Rob Pike: A little copying is better than a little dependency
- 2024-12-16 14:15: Private methods in Rails helper models are still available in views
- 2024-12-16 16:42: Stimulus auto-typecasts action parameters that look like JSON
- 2024-12-17 08:05: One can't just cd "~/New folder". It should be cd "$HOME/New folder" or cd $HOME/"New folder" instead.
I’ll probably change it to a random one if the initiative survives the test of time.
The script expects a NOTES_PATH environment variable and fails fast if it's not set or doesn't exist. When called without arguments, it shows the last 10 entries with timestamps stripped for cleaner reading.
It's not meant to be a sophisticated knowledge management system. Just a frictionless way to capture small discoveries before they disappear. Sometimes the best tools are the simplest ones.