Mike DalessioMike Dalessio
NYC Standup Round-up for Dec 28th - Jan 8th
edit Posted by Mike Dalessio on Monday January 11, 2010 at 11:54AM

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
    end
    

    The structure of this code suggests that bar is scoped only within the context of foo. But alas, that is not the case. Ruby simply defines Thing#bar the first time foo is 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::Base with Double Ruby (also known as RR), and you're having issues, try stubbing the method on ActionMailer::Base directly. There's some weirdness there with method_missing in Rails 2.3.

Help Wanted

  • Does anyone know how to make command-1 through command-9 switch tabs inside of Term.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 set selected on the generated options. This appears to be a boog, and anyone who's interested in helping a Pivot write a patch, please comment below!

Comments

  1. Cody Caughlan Cody Caughlan on January 11, 2010 at 12:53PM

    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

  2. Stephen Stephen on January 11, 2010 at 01:02PM

    Another Magic Mouse gesture app is jitouch, 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.

  3. Nat Nat on January 11, 2010 at 01:47PM

    Enterprise Rails is an amazing book, I can't recommend it enough.

Add a Comment (MarkDown available)