TimeHub.net: our entry for the Rally on Rails contest
Aug
18

Last weekend I participated on the Rally on Rails contest with Hock and Pemberthy. It was an interesting experience, so here’s how it went.

The idea

The day before, we had no idea what we were going to code. We had had two brainstorming sessions; one one month before the contest and the other one one week before. We had thought of several things: a voice chat app to allow calls inside the browser, an app to share payments between roommates, an app to suggest cocktails and shots to your friends, an app to help you classify GitHub issues and several other ideas that we discarded for one reason or the other.

We were talking on Skype when I remembered I had to send an invoice to a client. “Shit, now I have to go through all those GitHub commits to see how much time I spent on that”, I thought. Then I had the idea! Why not create an app that could generate invoices based on my GitHub commits?

We discussed a bit about it on Skype and then we all agreed on it (except The Wise who flaked alleging he had a lot to do during the weekend. Later he admitted he was going to spend it playing StarCraft and eating pizza). Pemberthy bought the domain timehub.net and we parted, getting ready to meet at 7AM the next day.

The contest

Friday night

Pembe called me Friday around 7 or 8PM to tell me the contest had started and he had pushed the skeleton of the Rails app to the GitHub repo we had been assigned. I didn’t get it; the contest was supposed to start the next day! But because of the time difference, the contest started earlier than I thought. I finished the beer I was drinking with some friends and went home. I coded the authentication part of the app using OmniAuth. Since the idea of our app is based entirely on integrating it with GitHub, I took a look at the GitHub API to see how we would tackle that part the next day. I went to bed at around 11PM to be fresh for the next morning.

Saturday

We met at my place. Hock and Pemberthy brought buñuelos and empanadas for breakfast. We were all eagerly excited and ate as fast as we could to get down to business. We assigned tasks for everyone and started coding. Pemberthy started creating models and basic views for them, Hock started setting up the server and configuring the domain name and I started tackling the part of our app that would connect to the GitHub API. I found a few gems for that, but I didn’t really like anyone of them so I coded it myself using the awesome HTTParty gem. Then I don’t truly remember who did what; we just shouted what needed to be done next and someone took care of it.

The methodology we used was probably the most exciting to work with: we barely planned anything of what we were going to do and we decided to write no tests. Not a single one! Those who write tests know how it feels to have untested code, it’s almost like being pointed at with a gun. But we thought we didn’t have enough time to write them, so fuck it.

We took a break and went outside for lunch. It was a sunny and refreshing day. While we ate some burgers we had our only “meeting”, where we decided a lot of the stuff we were going to do next. Our goal was to have all functionality working for that night and then use Sunday to fix bugs and improve the user experience. Then we worked straight until 11PM when we were totally exhausted. I felt like I had no brain anymore. I could barely sync my movements; drinking water was amazingly hard. Pemberthy and Hock left and we agreed to meet the next morning at 9AM. I went to sleep straight and dreamed about winning the Rally.

Sunday

I woke up a little bit earlier than agreed, had breakfast and started to work. A good night’s sleep is the best tool a programmer can have. The senseless hard-to-find bugs of the night before were now ridiculously easy to fix. We had practically finished all functionality, with a few exceptions, so when Pembe and Hock arrived we were all confident we would finish on time. Hock did a great work polishing the CSS of the app while Pembe and I tackled most of the bugs.

I wrote the one and only test for the app when I was writing the part that parsed commit messages, and only because it involved seriously hard-core regular expressions. Just so you get an idea:

Writing tests was the only reasonable way of making this part of the code work, so I felt obliged to do so.

For lunch, we ordered a pizza and drunk a few beers. Is there anything that feels better than drinking an ice-cold beer with one hand while writing Ruby code with the other?

About one hour before the contest ended, we found a couple new bugs. This was the only part of the contest where I was stressed. We were deploying fixes and then seeing we had broken something else (if only we had written tests!). After a stressful round of deploys, the app finally looked stable enough and we decided it was time to stop. We looked at the clock: 10 minutes until the contest ended.

The result

Overall, I’m very proud of TimeHub. I’m sure it’ll be an insanely useful tool for me. Here’s a quick tour of how it works:

Add time notes to your GitHub commits

Import your commits to TimeHub and select the ones you want to generate an invoice from

The time for each commit will be automatically parsed from the tags you wrote on its message, or from the time elapsed since the last commit (unless the last commit was made more than 2 hours ago).

Create your invoice

There you go! Download the PDF. That took 3 seconds!

Of course, be sure to check TimeHub out and let me know what you think about it in the comments section below!

Predictions

You can check out all other submissions for the Rally on Rails on the Teams page.

My predictions for the first 3 places are:

1. TimeHub.net by Funky Town (Definitely the most useful app in the competition. Of course, I’m biased.)
2. SecretLiker.com by Yotoco. (Very fun to use, specially when you sign in with Pemberthy’s account and start saying your male friends are sexy without Pemberthy actually knowing.)
3. GemTalk by 25cm+ (Very pretty design.)

My prediction for the last place is undoubtedly Dumuzzi by Cidadelas Jedis. The monster they have as a logo is enough to make any child shit on his pants.