Simply Invoices now supports fetching your time data from Tick and Harvest. As previously mentioned I made a gem for Tick and now I’ve also made one for Harvest.

Installation

gem install tickspot-ruby
gem install harvest-ruby

The gems do not cover either of the APIs 100%. I implemented what I needed. If you need more, hack away!

Sources at github: Tick Ruby Gem and Harvest Ruby Gem.

Tickspot API Ruby Wrapper

April 12th, 2008

I’m investigating adding support for creating invoices from time logged in Tickspot to Simply Invoices. The first step of that is to write a ruby wrapper for their API. I’ve created a github project for that and am making it publicly available. You can find it at http://github.com/bricooke/tickspot-ruby. Hopefully someone finds it useful. Or even better, makes it more useful :)

To make it more accessible, it should probably be a gem :/ Baby steps.

Update 4/14/2008: It’s now a published gem. gem install tickspot-ruby

After shuffling some code around I found myself with a lot of files to remove from git. Instead of doing it by hand or trying to ensure a subdirectory is gone and use -r, I wrote this rake task:

namespace :git do
  desc "Remove removed files"
  task :remove do
    system("for i in $(git status | grep deleted | awk ‘{print $3}’); do git rm $i; done")
  end
end

If you use sake, this task is available on pastie @ sake -T http://pastie.caboo.se/177861.txt

mybizexpenses.com is mentioned in the latest entry of the always educational, “The Rails Way”. Jamis points out how I should be using named callbacks and a simple way to make a confusing function, well, not confusing.

The article is pretty short, but very handy. I didn’t know named callbacks existed.

I really love how much a lot of the high profile rails folks give back to the community via things like this.

I have an automator workflow that I’ve been using that others might find useful. It’s heavily based off of the web20show’s own script (original here). The biggest difference (if I remember right) is my flow takes the project directory as an argument vs. asking for it. It opens 3 iTerm tabs. 1 running ./script/server, 1 running autotest and 1 just sitting in your projects directory. localhost:3000 is then opened in your default browser (usually before the web server is ready) and TextMate is opened with the interesting directories loaded in (does not open ‘logs’ or ‘vendor’ or stuff like that).

For a long time I ran this as a Finder plugin. That required finding the project in Finder, right clicking on it and saying Automator -> RailsWork. Lately I’ve switched over to having the workflow be a .app and opening my project folder with that .app via QuickSilver.

I have a 48 second screencast of that in action. And of course, the workflow is available too: RailsWork.workflow.zip

update about requirements: The workflow uses TextMate, iTerm and requires TextMate be setup with its ‘mate’ command described here.

Walk a Hash with SyncEnumerator

February 15th, 2007

I again was fumbling through PickAxe version 2.0 and stumbled onto SyncEnumerator. One use I see for SyncEnumerator is to walk both the keys and values of a hash, like:

require ‘generator’

ahash = {:five => 5, :six => 6, :seven => 7}
SyncEnumerator.new(ahash.keys, ahash.values).each do |k,v|
  puts "#{k} equals #{v}"
end

The pickaxe is quickly becoming very valuable to me.

require 'pp'

February 13th, 2007

It wasn’t long into my use of ./script/console that I desired a prettier print method. As a gdb user, I was used to ‘set print pretty on’. I spent a few minutes trying to figure out how to do the same in console/irb and failed and moved on. Today I was thumbing through my new copy of PickAxe rev. 2 and stumbled into ‘pp’. Let’s look at the difference:

>> p Task.find(:first)
#<Task:0x314474c @attributes={"job_id"=>"2", "id"=>"1", "description"=>"fill out the unit tests for the existing model and controllers", "duration"=>"80", "started_at"=>"2007-02-02"}>

Not so pretty. Let’s try pp:

>> require ‘pp’
=> ["PP"]
>> pp Task.find(:first)
#<Task:0x3150ba0
 @attributes=
  {"job_id"=>"2",
   "id"=>"1",
   "description"=>
    "fill out the unit tests for the existing model and controllers",
   "duration"=>"80",
   "started_at"=>"2007-02-02"}>

Much better!

update: Colors provided by SubEthaEdit’s fancy “Copy as XHTML”.