Points of Interest
Following a recipe from Dan Chak‘s Enterprise
Rails, we came across code following this
pattern:class Thing def foo def bar(args) # some code end # some code that calls bar() end endThe structure of this code suggests that
baris scoped only within
the context offoo. But alas, that is not the case. Ruby simply
definesThing#barthe first timefoois called, analogous to
define_method :bar. Misleading syntax, for sure.Ryan Davis‘s Flay is awesome. If you’re not
familiar with it, Flay parses your Ruby and compares subtrees with
each other to find where code has been duplicated (or nearly so).
Run on a codebase of over 20,000 lines of Ruby, Flay was able to
quickly indicate places where we had duplicate code lying around, as
well as many likely targets for refactoring work. We’ve found it to
be helpful in keeping code DRY.This looks interesting: MagicPrefs gives you gestures
for your Magic Mouse (Yes, Pivotal NYC has Magic Mice, as well as
27″ iMacs. Apply today!).In Snow Leopard, mapping CapsLock => Ctrl when two keyboards are
plugged in is problematic. You can do it by plugging in one keyboard
at a time and mapping each one individually. If anyone knows the
story behind why this is, or how to deal more easily, please comment!Another interesting link: Open Frameworks is a
“creative coding” toolkit (like Processing) that’s
implemented in C++. Why ask why?Another lesson learned the hard way: starting up a bunch of leopard
machines at the same time wreaks havoc on the network for a few
minutes. Packet storm, dropped packets, etc. Is Bonjour to blame?
Inquiring minds want to know.If you’re trying to stub a subclass of
ActionMailer::Basewith
Double Ruby (also known as RR), and you’re having issues, try
stubbing the method onActionMailer::Basedirectly. There’s some
weirdness there withmethod_missingin Rails 2.3.
Help Wanted
Does anyone know how to make
command-1throughcommand-9switch
tabs inside ofTerm.app? By default, these keys are bound to
switching windows, and we’d love to be able to do this on tabs
instead.Rails’s
select_tag(..., :multiple => true)option doesn’t properly
setselectedon the generated options. This appears to be a boog,
and anyone who’s interested in helping a Pivot write a patch, please
comment below!
> Does anyone know how to make command-1 through command-9 switch tabs inside of Term.app?
Its still a little buggy in Snow Leopard (doesnt work 100% of the time, sometimes yes, sometimes no), but stable in Leopard:
http://ciaranwal.sh/2007/12/10/tab-switching-in-terminal
YMMV
January 11, 2010 at 12:53 pm
Another Magic Mouse gesture app is [jitouch](http://www.jitouch.com/), which not only adds gesture for the magic mouse, but also the touchpad. I’ve been using it for the past few days for the touchpad features, and it makes a lot of tasks easier. Plus, the gestures are really cool.
January 11, 2010 at 1:02 pm
Enterprise Rails is an amazing book, I can’t recommend it enough.
January 11, 2010 at 1:47 pm