Big shout-out to this typo, that’s managed to survive over a decade of not being fixed.
I admit I stole this idea from Tumblr, or rather I stole it from updating my (unreleased) WordPress-to-Tumblr crossposter plugin to support Tumblr’s support (“support”) of OG cards.1 I figured the idea would be cool to implement locally as well, and when I couldn’t find an existing plugin that did exactly what I wanted, I decided to write my own.
- I say “support” because Tumblr doesn’t auto-populate OG cards for link posts created by the API because… reasons, I guess. Also, I still can’t get it to accept the
photosproperty, because… fuck you Tumblr, I guess. ↩
So some of you may remember a while back I started “playing” (using?) HabitRPG. Habit is basically a cross between a task management app and an RPG game. Instead of things like “kill ten rats”, your quests are things you define from your own todo lists, like “go to the gym” or “write your goddamn book you lazy bastard”.
Habit has three types of tasks: habits are ad hoc things you want to either do (giving rewards), or avoid (bringing pain); dailies are things you want to do either every day, or every Tuesday, or every Sunday and Wednesday, or whatever; and to dos are “projects” you want to do at some point, then tick off.
One of the downsides of Habit is that it doesn’t support recurring tasks that aren’t liked to a particular day of the week. So, for example, I have a daily to take the bins out every Sunday (because that’s when garbage collection is, and it doesn’t make sense to do it on another day), and a habit for washing the dishes (I won’t cry if it’s not done every day… but I should do it). But what about, say, re-dying my hair, which is something I generally want to do on the first Friday of every second month, although if it waits a few weeks it doesn’t matter much (I’ll just suffer through a faded dye job)? Or what about my gym schedule, which is alternating weights and cardio, though, again, doesn’t really matter if I don’t go literally every single day?
Yeah. This can get complicated real quick.
Fortunately, Habit has an API, and I know some PHP scripting. So I whipped up something cute and dinky containing all my silly task auto-creation logic, and run it once a day with cron.
The foundation of the script is a very simple class to access the Habit API, which looks like: (more…)