Train to not suck at life

In an early edition of the CrossFit Journal, Coach Glassman talks about the foundations of CrossFit (pdf):

We have designed our program to elicit as broad an adaptational response as possible. CrossFit is not a specialized fitness program but a deliberate attempt to optimize physical competence in each of ten recognized fitness domains.

These fitness domains are:

Endurance, Stamina, Strength, Flexibility, Power, Speed, Coordination, Agility, Balance, and Accuracy

It’s no surprise that some CrossFit gym’s use the “Train to not suck at life” tagline, as these fitness domains are all critical aspects to our personal success, no matter what our aim.

I’ve been thinking about success factors a lot since watching Malcolm Gladwell’s great presentation at PopTech, loosely based on the content of his new book, Outliers.  Watch this presentation, then ask yourself “what effects my own talent capitalization?”

Now, Gladwell has made clear that we’re too focused on the individual.  His book focuses on the environment around us, our culture, our birthplace and even our date of birth, which has enormous effects on how our talents are capitalized.  I do agree with Gladwell on these points, but as an individual myself (and you too, dear reader) it is always alluring to focus inward with an aim to do whatever it is we do, as well as we can do it.  While I’ve never read any “self-help” books before, I can see why they are so popular.  After watching that presentation, I couldn’t stop thinking about how we could measure our performance in a more general sense.

I’d bet that if we think hard enough, the primary issues that affect the capitalization of our own talents are weaknesses in several of those fitness domains.  CrossFit may imply that those domains are for physical fitness, but as any athlete will tell you, mental fitness is as important if not more so.

Luckily for CrossFitters, improving fitness across those domains is easy.  Do your CrossFit workouts and you’ll get more fit across the board.  It’s also easy to track your fitness progress, which was the primary motivation for my building statulo.us.

For thought workers, though, it may be hard at first to see how our mental fitness stacks up across these fitness domains.  Let’s take a stab at describing how these terms could be applied to the average worker.

Endurance

the power to withstand hardship or stress

Tight deadline?  Fast approaching ship date? How well do you deal with the stress in your life?  How well do you endure the discomfort of useless but necessary(?) business meetings?

Stamina

strength to resist fatigue and tiredness

So much of corporate life can be tiring.  Cube dwelling zaps creativity, conference calls can quickly become white noise and idle chatter can challenge even the well rested.  How do you sustain your energy throughout the day?

Strength

durability; determination; resolve; power; intensity; force

Implementing change in any organization requires the strength to to encourage, to challenge and to lead.  When you find something worth fighting for, how much strength can you muster?

Flexibility

susceptible of modification or adaptation

Pragmatism.  Unyielding focus in a single direction, without input from others, will ultimately kill you.  Staying focused on your goals while being flexible about the details will always require less effort, and produces much better results.

Power

the rate at which work is performed for a given period of time

“I’m going to put my head down and just crank this out.”  When all those pesky decisions have been made, the goal is in site, and its just time to get ‘er done.  How do you build and sustain your power?

Speed

the rate at which an object moves

Nobody needs more red tape. Get moving!  Don’t stand in the doorway, don’t block up the hall.

Coordination

Harmonious interaction; synchronizing movement.

You work with others, each of you depending on one another.  How well do you coordinate with your peers?  How well do you coordinate the work you do?

Agility

moving quickly and lightly

I think we get this one.

Balance

equality of distribution

You play many roles from day to day.  How well do you balance the demands placed against you with your desires as a person?  If you’re stressed out, you’re out of balance.

Accuracy

the quality of being near to the true value

After all that, did you create anything of value?  Were your aims true?  Was it worth it?

How do you rate?

Precision would miss the point.  Every day may bring us something different, something new.  But that actually is the point.  Diversity, that marrow of life, requires all of the above.  How do you handle it?  How do you rate?  How do you train to not suck at life?

Quick and Easy: Cache RSS feeds in your Rails app

Displaying a feed within your Rails app is pretty easy.  It turns out caching that rss feed is pretty easy too.  I recently added cached rss feeds to an app and had a few tiny hoops to jump through, so I thought I’d document them here for anyone else looking to solve the same problem.

Caching is easy.  Cache invalidation is hard.  For an RSS feed, we’d have to ping the feed to determine if any data had changed.  Why bother?  Instead of fetching the RSS feed on every single page request, let’s cache it for a fixed period of time.

The timed_fragment_cache plugin adds a duration option to the Rails cache method, allowing you to specify how long to cache a fragment of code.  So, get your ./script/plugin install git://github.com/GeorgePalmer/timed_fragment_cache.git on!

To integrate that cache method into a page, it might look like this:
The render_rss_feed helper method looks like this:

And from there, pretty up that feed however you like.  Here I’m just using the link, title and date:

private method `gsub’ called for #<StringIO:0×2575df8>
If you are using Rails 2+ and you try to get fancy with that duration specification, using something like 30.minutes.from_now, you’ll end up getting that gsub error.  Here is why:

Note: 30.minutes.from_now.time will result in a Time class, and will work equally as well as (Time.now + 30.minutes). It’s up to you which of those two are more readable and intention revealing.

New gem: greatest_common_factor

Ruby already provides the ability to find the greatest common factor (gcf) of two integers. What if we could determine the greatest common factor across a whole array of integers? Now we can.

I’ve just released greatest_common_factor on github.

Here is a sample of what you can do with it:

Enjoy!

Transparency, Responsibility, Accountability

Kent Beck speaking at RailsConf 2008. I think this is the most interesting and poignant presentation of the year.

statulo.us - how getting fit somehow still involves programming

First, David Heinemeier Hansson spoke of the surplus.  Spend it on yourself, he said.  Invest in you.

What does that mean to you?  How do you interpret that? Jamis got into woodworking.  Somebody else is playing the banjo.  The ukulele perhaps?  “Get out of your editor”, David said, and I somehow quickly forgot about that part.

When I heard David talk about that surplus, I could easily identify.  I felt like a race car driving on city streets.  I had more to give, but coudln’t find that perfect outlet.  I spent a while digging into new technologies instead.  I worked with git.  I dug deeper into Ruby and Rails.  I read classic programming language textbooks.  Essentially, I did what I always do.

Then I went swimming.  On a trip to Tahoe in early July this year, my family and I were at a pool when I heard a lifeguard shout something I hadn’t heard in years.  “Adult Swim!”  Sweet!  The kids hopped out (mine included) and I decided to do some laps.  The last time I swam laps in a pool, I was more concerned with Merit Badges than ROIs.  Perhaps unsurprisingly, I sucked.  I did two down-and-back laps in the olympic pool, and came up sucking wind like an idiot.  I tried to reconcile my embarassment by thinking about the altitude.  Sure, swimming at 6k feet may be a little harder than sea level, but yours truely was out of shape!

I’m an emphatic person. I do something emphatically, or not at all.  If I was going to attempt to attain personal fitness, I was going to have to do it right.  There are all sorts of paths.  My friend Shawn is running a marathon.  I could run to the edge of my driveway if my house was on fire, but I don’t think that marathon stuff would work for me.  All the stuff I saw in traditional gym settings seemed lame.  Use a stationary bike with a sweaty guy shouting at me over lame techno music?  No thanks.  I needed something intense and exciting.  I needed something fun.  This would fill my surplus.

What I needed, as it turns out, was to be Crossfit.  I reconnected with a friend from high school who had spent some time as a Navy Seal.  He was into this “Crossfit” thing, so I had to check it out.  I won’t attempt to summarize for you, but do yourself a favor and check out that main website.  Crossfit is intense.  It’s exciting and it’s incredibly fun.

I found a local crossfit gym and signed up for group classes.  I’ve also converted half of my garage into a reasonable home gym, but the intensity in the classes is what it’s all about!  During my first class, we did a Crossfit named workout, and everyone was jotting down their times in a notebook.  A notebook.  The paper kind.  See, Crossfit workouts are timed, because slow workouts are less efficient and do much less for your body.  With timing being key, folks keep workout journals on paper, on the Crossfit forum or on their own blogs.

Opportunity was knocking.  The thought of writing my workouts down in a notebook gave me the kindergarten willies, and using a forum or blog had their own set of problems.  What was my last time for Fran?  How much have I improved in the last month?  It was all lost in paper or pagination.  Lame.

Here I was, trying to fill my surplus by getting out of my editor, and my fitness choice led me right back in.  My wife was going out of town for a weekend, so I had two solid nights of hacking available.  Constraints are wonderful.  I jotted down some ideas during the week, checked out some graphing libraries and got a general idea of what I wanted to do.

After two nights of hacking, the first version of statulo.us went live!  I’ve added several features since, and have accumulated a reasonably sized user base, primarily from my local gym.  The weekend project was such a testament to Rails, enabling a reasonably interesting web application, using graphs of user generated data, some RSS feeds and plenty of Crossfit-specific features.

The best part, though, is that by giving back to the Crossfit community immediately after jumping in, I get back that much more from them.  The feedback on statulo.us has been great, and has brought me closer to my trainers and fellow Crossfiters.

This path of personal fitness has no end, and I’m looking forward to continuing my newly minted active lifestyle.   Especially now that I know it also involves programming!

Check out statulo.us, the free Crossfit-based fitness tracker.  Maybe you too will fill your surplus, and be all the better for it.

Next Page →