Sunday, August 31, 2008

Learn these keyboard shortcuts ...

... for better TextMate project window management.

First, open Keyboard.prefPane and map Control-Command-Z (^⌘Z) to "Zoom". (Detailed instructions can be found here, and the example he uses is this exact shortcut, in case you weren't convinced this is the right thing to do.)

Now open up a project in TextMate so that you've got the project drawer showing.

Ready? Here's your new keyboard calisthenic routine.

  • Control-Option-Command-D (^⌥⌘D or "mash D") to Hide Project Drawer
  • Control-Command-Z (^⌘Z) to Zoom the editor window to fill the screen
  • Control-Command-Z (^⌘Z) again to Zoom the editor window back to a size that can accommodate the project drawer
  • Control-Option-Command-D (^⌥⌘D or "mash D") again to Show Project Drawer
  • Option-Command-Backtick (⌥⌘`) to move focus to the drawer
  • Option-Down (⌥↓) to jump to the bottom of the drawer
  • Option-up (⌥↑) to jump to the top of the drawer
  • Option-Command-Backtick (⌥⌘`) again to move focus back to the editor
  • Again! Faster!

UPDATE: Note that the second Control-Command-Z (^⌘Z), while excellent exercise, isn't really necessary. TextMate will automatically zoom out the window if you ask for the project drawer and there isn't any room for it. Sweet!

Friday, August 15, 2008

A Ruby Metaprogramming Introduction Updated

Update: The Rspec conversion is done, and I added a section demonstrating macro methods. Read the latest here.


Early last year I published A Ruby Metaprogramming Introduction on the Practical Ruby blog. Earlier this year while commuting back and forth between Grand Central and White Plains—not a place you should strive to commute to, though MetroNorth is far better than the subway for giving you room to work on a laptop—I started making refinements and converting it to use Rspec instead of custom Test::Unit extensions.

I put it aside for a while but am now resolved to continue work on it. I've just put that work onto Github, so anyone with an interest can take a look, browse history, and even submit suggested patches.

The project is located here:
http://github.com/duelinmarkers/metaprogramming_introduction/tree

If you're annoyed at the half-Rspec state of things, you can read the originally published version in this tree. (It's way prettier as rendered on Github than I could probably manage to get it on any blog.)