eddieroger.com

Always fluxing.

Better Workouts Through Code

| Comments

OK, that’s a stretch, but if you’ve been following my tweets (or blog posts, or Facebook statuses), you’ll see that I’ve been working out. I’ve even written about it before, and you can see the Nike+ widget documenting my “runs.” You may notice that widget isn’t updating, and that’s because I’ve switched to the elliptical instead of the treadmill.

So what’s a guy to do? I need to document what I’m doing for my own sake, but also as proof since I feel the need to validate my workouts.

Following random tweets, I came across this one from bjhess, a Minnesotan and RUMmy. He made mention of something else altogether, the Seinfeld Calendar. To save time, the idea is that if you take a big calendar and make big marks on the days you’re doing whatever you’re tracking, then you’re 1) more likely to do it, and 2) it gets easier. I was already on the road to tracking my workouts through Nike+, but I need something to document the other stuff.

Loving PHP for some time now, my thoughts went back to a calendar script I wrote a long time ago. Originally, it was for fun, then it was for the Sammy website, then assorted other tasks here and there. But, it was well written once and definitely reusable. So, I did. I grabbed a big red “X” to indicate days I worked out, removed all of the old database code that pointed to systems I haven’t run in a while, and replaced it with new references. A few CSS changes, some quick JavaScript and a ton of debugging, and I got this:

Eddie’s Workout Calendar

Go check it out. It’s pretty simple, but I have already over-complexified it by making it code based instead of just buying a paper calendar. But, I’m never one to pass up a chance to code something, especially when it’s relatively “simple” and “fast.” (It was neither.)

I really can’t stress enough that the idea for this wasn’t mine, but those I cited above. As such, if you really want to see the code, let me know - the only way I can share the credit is by sharing the work. It’s also worth noting that this is one of the reasons I love PHP and come back to it frequently. No controllers, no scripts to generate models or database code, no Eddie modules or clusters or proxies just me and some SQL queries. Quick and dirty.