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 withspec. 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