Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 6/10/2011: scp’s magical tab completion

Gregg Van Hove
Friday, June 10, 2011

Ask for help

  • Some pivots on an Android project were trying to remember if there was any way to turn of overscroll glow in lists.

Interesting Things

  • DevOps Days is coming up on June 17 & 18. They appeared to be sold out before, but are now inviting people off the waiting list, so if you want to go sign up.

  • When using scp to get files from a remote machine, it actually uses ssh to get into the machine to do tab completion of the remote filesystem.

  • When running specs through rake, FactoryGirl factories are evaluated before fixture data is loaded, which is the opposite of what happens when running directly with spec. This manifests itself with really broken factories if they need to load fixture data but do it too early.

All this means is, don’t write your factories like this:

Factory.define :foo do |f|
  f.bar Bar.find_by_number(100)
end

Write them using the lambda syntax like this:

Factory.define :foo do |f|
  f.bar { Bar.find_by_number(100) }
end
  • Some pivots were noticing what seemed to be strange behavior when using the ‘and’ keyword in ruby, because it has the lowest precedence in the language.

Some demonstrations:

> def foo1
>   puts 'foo' and false
> end

> a = foo1
foo
 => nil
> a
 => nil

If you try to wrap the 'foo' and false in parentheses, be careful of your spacing:

> def foo2
>   puts ('foo' and false)
> end

> b = foo2
foo
 => nil
> b
 => nil

> puts('foo' and false)
SyntaxError: compile error
(irb) syntax error, unexpected kAND, expecting ')'
puts('foo' and false)
           ^

Using && is a little more predictable

> puts 'foo' && false
false
 => nil

Or the difference when assigning not just printing:

> x = 'foo' and false
 => false
> x
 => 'foo'
> y = 'foo' && false
 => false
> y
 => false
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Add New Comment Cancel reply

Your email address will not be published.

Gregg Van Hove

Gregg Van Hove
San Francisco

Recent Posts

  • Standup 02/23/2012 – Charts are cool
  • Standup 02/22/2012: Apache trying to compete with Nginx?
  • Standup 10/7/2011: Google says NO!
Subscribe to Gregg's Feed

Author Topics

agile (11)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >