Tweets to Make You Look Up

Posted on September 16th, 2009 in life | No Comments »

As a space junkie, I frequent nasa.gov and astronomy picture of the day sites to marvel at the universe and our attempts to learn and explore it. One of my favorite sites is the venerable Heavens Above created and run by Chris Peat. If you haven’t checked it out, please do so soon as it gives lots of very useful information for observing satellites such as space shuttles, international space station (which is large enough to be seen in the daylight hours), Hubble space telescope and hundreds of others. If you register with the site or plug in your location, you can get lists of dates/times to see things like the space station fly overhead. My kids think I’m a genius because I’ve been known to look down at my watch during dinner and announce that the ISS is about to fly overhead – we all run outside and I start a countdown and poof – right on cue – a big bright star starts a lazy, 5 minute pass overhead. All thanks to Chris Peat’s great web site. You can even get star maps and ground track paths to help you get oriented.

I sometimes forget to check the site so I setup an automatic twitter feed to send me reminders. Was very easy to do …
Read the rest of this entry »

Silly Simple Git Initialization for your Rails Projects

Posted on July 6th, 2009 in rails | No Comments »

It is such a joy to have such great technologies at our fingertips. Ruby on Rails can be a fantastic productivity booster for projects but I often find I get huge benefits from it for simply exploring ideas or working up a quick functional prototype. By adding on things like customized generators that suit your client’s configuration and customizable menus, you can get to a workable prototype in record time (minutes to hours).

Part of the benefit of working with rails projects is the speed with which you can refactor and scaffold your way into different configurations. This can sometimes get you into trouble if an experiment or plugin doesn’t work. The best solution I’ve found for this is to ALWAYS initialized your fresh rails project into a git repository. This is like having infinite idea or skill mulligan’s for your project – a great safety net that let’s you go fast without fear.

Ryan Bates’s excellent screen cast series had a nice review of using git with rails and one of the commenters (Pete Yandell) offered a script to simplify life. This script sets up a standard rails project into git with the proper ignores. I modified the original script slightly to avoid placing .gitignore files into the empty directories within the .git directory. This is a harmless change but it seems cleaner to me. Here is my version of it:


#!/bin/sh
cat < .gitignore
log/*.log
tmp/**/*
db/*.sqlite3
coverage
doc/app/*
EOF
find . -type d -empty -exec touch {}/.gitignore \;
git init
echo "TODO - provide project README" > README
git add .
git commit -a -m "Initial import."

(here’s the gist)

This script works great (on OS X anyway) for setting up a project in git. This allows me to extend the ‘prototype’ from hours to multiple days if I need to without losing control or risking breaking the whole thing with a laps of concentration. I can create branches for experimental ideas and quickly switch back and forth. As long as my migrations are current and especially if I’m using data generators like populator, I can switch between branches to show my client a few different ideas or behaviors within seconds.

It is so great to have a (revisable) history of what I’ve done on a project. I can also quickly stash an idea away to work on it later. No matter what I do on the prototype, I can always recover back to some previous spot without much fuss or concern.

This technique works so well because it is all self contained within your rails directory and because it is such a low-overhead and fast approach.

The approach works like this:

  1. rails some_new_project
  2. cd some_new_project
  3. git-rails
  4. work on project for minutes or weeks with frequent checkins
  5. create branches, rebase, squash commits, what ever – repeat previous steps
  6. if want to keep it, move it to a public repo, if not simply rm -rf the entire directory…

Rails and git are really two powerful tools that have greatly revolutionized my personal work flow. I get to move quickly and with the assurance that I can undo any bad ideas. Infinite idea mulligans. I also get to practice using git even if my client is stuck on subversion (or worse). I highly recommend ALWAYS setting up your rails projects this way.