Posted on July 06, 2008
UPDATE: This approach is no longer necessary as you can pass --colour to your story runner. You can still use the script for plugging in growl support.
If you’re into autotest and redgreen you probably miss your colored test output while running your Rspec Stories.
A standard story output looks like this:

You can pipe it to this simple colorize script and get:

... yellow pending messages, or:

... red failures.
That helps me spot where pendings and failures are when running large stories.
PS: this script eats up lines if you’re running the debugger. Feel free to improve it and send back patches to me.
PPS: the color stuff has been ripped off from redgreen.
This script plug nicely in growl support if found in your path.
Paolo
Filed under: Tips & Tricks |
Tagged with: redgreen rspec ruby |
Posted on July 02, 2008
If your application is dealing with different time zones and code which relies on them, it could be handy to ensure the database is using the time zone you expect it to.
drop something like this in a rails initializer:
#
# Check that that database is running in UTC
# and stop if it's not.
#
db_now = ActiveRecord::Base.connection.execute(
"select now() as now" ).fetch_hash['now']
utc_now = Time.now.utc.to_s(:db)
if db_now != utc_now
raise LoadError, "ERROR: Database is not in UTC"
end
btw: you should thank david, not me.
Filed under: Tips & Tricks |
Tagged with: rails timezone |
Posted on June 12, 2008
About a year ago I posted about a way to manage your todo list with GMail.
The concept is simple: label your emails as TODO and search through them. Next actions are just starred TODOs.
Labelling and filtering your email with GMail is a snap, but in order to have cool “todo” and “next action” links available through the interface I had to use greasemonkey and saved searches.
Nowadays, with google updating GMail and me switching to osx/safari, that solution doesn’t work anymore.
Luckily enough I noticed that GMail searches are now bookmarkable… so here I recap the steps for setting up your minimal todo list:
- create a new contact named todo whose email is your_account_name+todo@gmail.com (eg: paolo.dona+todo@gmail.com)
- create a label named todo
- create a filter matching to:(your_account_name+todo@gmail.com) and flag: Skip Inbox, Apply label “todo”.
- now search your mail for label:todo and bookmark the page as [todo]
- search your mail for label:todo is:starred and bookmark the page as [next action]
you should get something like (todo):

and (next action):

Have you noticed the [todo] and [next action] bookmarks I put in my Bookmarks Bar?
I know this is not a solution that suits everyone’s needs, but it brings a couple of pros:
- I can add filters that automatically populate my todo list from incoming emails.
- I can play with labels and easily let todo items belong to projects, locations etc (GTD style).
- I do not have to implement my own todo list manager as most rails programmers do :)
Happy GTDing!
Filed under: Tips & Tricks |
Tagged with: gmail gtd |
Posted on February 22, 2008
Sometimes I have to deal with messy html like this:

As you know, indenting it manually is a pain… but I just found out this cool TextMate feature, Filter Through Command:

You can filter your file through a shell command and substitute the content… here I’ve chosen the osx built-in tidy to clean up my html:

And voilà, your html gets pretty formatted in a snap…

I just need now to find out a way to automatically strip tidy’s comments at the top of my document… but the annoying part has been done. Pretty simple but clever stuff.
If you know better ways to do this… let me know!
Filed under: Tips & Tricks |