interblah.net » conflagration over configuration
Welcome; view the source of this snip (the start snip) to see what's going on; find out more at vanilla-rb.
2009-06-10 10:32:38
Accessing RDoc fast using Quicksilver
Inspired by this, but prefering Quicksilver to LaunchBar, I hacked up a neat little way to browse the excellent RailsApi docs using a Quicksilver trigger. It's pretty simple to setup, and most of the credit goes to the original post and this trigger tutorial. Here's how to do it:
As a bonus, you can also install this as an action.
Download the docs
Download the appropriate RDoc zip from RailsApi. Here's what the interface looks like:

I chose basically everything, and I've unzip mine into ~/Sites/rdoc.
Create a virtual host
Next, we need some way of accessing the documentation. You can, of course, just double click the index.html file in the unzipped directory, but some of the later steps don't seem to like file:// urls, so I've set up a really simple apache virtual host, using a tool I stole from Chris Roos called hostess.
sudo gem install hostess
sudo hostess create rdoc.local /Users/james/Sites/rdoc
chmod -R a+r /Users/james/Sites/rdoc
This will create a new virtual host for our RDoc, so we can access it using http://rdoc.local. Note that you must ensure that Apache can actually serve those files by making them readable by everyone.
It's worth visiting the new virtual host now (http://rdoc.local) to make sure that it's all working.
Add the Quicksilver trigger
Following the instructions here, it's pretty simple to setup a custom keystroke trigger. First, copy this url:
http://rdoc.local/?q=***
Then open Quicksilver preferences (activate Quicksilver via whatever trigger you've set up, then type cmd+,), and choose the triggers tab

Click on the + at the bottom to add a new hotkey

Double click on the new entry, and you'll see this window drop down:

Now, paste in the url from above. You should see it populate the fields of the new trigger panel (though yours probably won't say 'ruby method' at the bottom, it's important that there is some text in there):

Finally, you'll want to set a hotkey for the trigger. I've chosen cmd+alt+ctrl+R, but you can choose whatever you like. Double click on your trigger under the 'Trigger' column, and you'll see this panel:

Click on the 'edit' button, and then press all the keys for your trigger keystroke.
Now you're good to go. Hit your trigger, then type the method name (or partial match), and hit enter.

Boom - your local Ruby documentation will be opened, with the search performed.
Installing as a Quicksilver action
Another way of doing is is using Quicksilver actions. This lets you type some text, then hit tab and type 'rdoc', and then hit enter to perform your search. As you can see, the flow is flipped around a bit, but some people might prefer it this way. Open Script Editor, and paste in this script:
using terms from application "Quicksilver"
on process text query
set rdoc_url to "http://rdoc.local/?q=" & query
tell application "Finder"
open location rdoc_url
end tell
end process text
end using terms from
Save this script as 'RDoc' in ~/Library/Application Support/Quicksilver/Actions, and restart Quicksilver. Double Boom.
2009-04-22 08:33:04
FreeAgent Widget for Mac Dashboard
Going freelance has introduced me to a whole bunch of new chores and challenges, two of which are
- figuring out how to deal with the legal and financial side of being a company, and
- keeping track of how I spend my time.
Thankfully, there's a tool which seems to hit the spot in terms of power and simplicity - FreeAgent. It seems to strike a great balance between gather all the information about expenses, payroll, taxes, invoices, timesheets and bills, whilst not requiring me to study accountancy to make progress.
Anyway, on my latest project (working with New Leaders via Free Range), I'm tracking my time in a relatively detailed way, and I thought it would be good to make use of the timesheet functionality that I'm already paying for. But, it's a pain to go to the website every time I need to track a task. So:
Download FreeAgent Widget 1.2 here. This is a Mac Dashboard widget, and so only works on Mac OS X.
It's fairly simple, functionally, but covers everything I need. Once you fill in your FreeAgent details, it will load your projects, and choosing a project will load the available tasks for that project. Hit the big middle button to start/pause timing, and then clicking "Post" will post that time to your account. I've added a few neat little tricks - try double-clicking the time and typing "1h30", for example.
It's not hugely sophisticated - you can't manage your existing timesheets, or add a timesheet for another day - but clicking the 'timeslips' text will take you straight to your timesheets on the site should you need that.
I hope it's useful for some people, and of course, since it's on GitHub you're free to fork and improve it. I'm also keen to try the new github issues feature if you're having any problems.
Updates
- v1.2 - now lets you add a comment to your timeslip, to help keep track of the specifics of what you're working on
- v1.1.1 - now only shows 'Active' projects. Great suggestion, folks. Keep 'em coming!
- Thanks for the mention on the FreeAgent blog :)
2009-04-06 12:14:18
Gem This
Most of the time, I don’t set out to write a gem.
But, sometimes, after a bit of time (which could be days, weeks or months) spent working on some code, I might decide that I have something worth making a gem.
It seems like many (if not all) of the existing gem-tools do some things that don't really thrill me. Either:
- They add themselves as a dependency, meaning that when someone installs my gem, they must install the gem-tool
- They expect to be used at the very start of development, creating a directory structure and imposing opinions left, right and centre
- Despite the "bonus functionality" of automatically uploading a website and blogging for me, the obscure what's actually going on
This doesn't suit the way I work, at all. I don't want to force anyone to download anything other than the code that is useful to them, and I already have my project set up the way I like. I just want to turn this library into a gem!
What I Want
My code is already there; it's in an appropriate set of folders, and probably has existing Rake tasks. All that I'm missing is the ability to build the gem, maybe push it to RubyForge, and build the RDoc. Perhaps I'm storing the code on github, so producing a .gemspec file is good too. And, most importantly, I want to be able to hack it to suit each project, without any further interference or opinionation.
It's simple enough to achieve this; all you really need is a few standard tasks in your Rakefile. So, I wrote a little tool to spit some fairly standard and easy-to-understand code into an existing Rakefile on my behalf. If I already have tests (or specs), it will produce a simple task to run those, and if there's a bin directory it will hook that up too, but that's pretty much it.
It's called gem-this; fork at will.
It's definitely not for everybody - I'm sure plenty of people get lots of mileage out of the existing tools and having a generated, standard structure for their gem code. I just don't find it very useful, personally.
More at the blog...
