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
Steve Ellis

Tuesday Brown Bag: @ykatz

Steve Ellis
Monday, June 18, 2012

Events

  • Tuesday Brown Bag: Yehuda

Yehuda Katz will be giving a brown bag on Tuesday at 12:30.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joelle Gernez

[Standup][SF] 06/08/12: coccyx: kok-siks; plural: coccyges

Joelle Gernez
Friday, June 8, 2012

Helps

  • CI request spec video gem?

suggestion: use Capybara error call back and a screen shot utility.

Interestings

  • Forgotten Feature: Rails redirect_to and flash

You can set parameters in the flash scope when redirecting:

redirect_to pants_path, :notice => “Successfully put on pants!”

redirect_to pants_path, :alert => “Pants are alight! Douse them forthwith!”

redirect_to pants_path, :flash => { :error => “What pants?” }

  • should_receive(”some_string”) gives a helpful ‘stack too deep’ error

Don’t accidentally pass should_receive a method name as a string instead of a symbol. You’ll get a lovely ‘SystemStackError: stack level too deep’ error.

  • coccyx: it plugs up backbone

https://github.com/onsi/coccyx

coccyx is a tiny little addition to backbone that I cooked up that addresses finding and fixing memory leaks by solving two problems:

1) you can pass constructorName in as a parameter when defining your Backbone class to get a custom constructor name printed out (instead of “child”) in console.log and in Chrome’s heap analyzer.

2) you can call view.tearDown() to automatically unbind any callbacks attached to view.model, view.collection, and delegateEvents. You can also add a custom beforeTearDown handler to clean up any other references you might be aware of.

The best part is: if you registerSubView() as you add subviews then calls to tearDown on a root node will walk the subview hierarchy and clean the subviews up too.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Brent Wheeldon

[Standup][NYC] 6/7/2012

Brent Wheeldon
Thursday, June 7, 2012

Interesting

  • A pivot needed to set some data in the flash for the setup of a controller test and discovered the optional 3rd and 4th parameters for ActionController::TestCase::Behavior’s get, put, post, etc. methods which allow the setting of session and flash respectively.
  • Yesterday was IPv6 day. On a related note, some hosting providers are starting to run low on IPv4 addresses and are encouraging people to move to IPv6 where they can.

Events

  • Tonight at 6.30 there is a panel in the event space called Startups: Their Journey to Success
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joelle Gernez

[Standup][SF] 06/06/12: Remember…

Joelle Gernez
Wednesday, June 6, 2012

Interestings

  • Nested route parameters are remembered

If you’re in a controller action and you get there via a nested route, any path helpers you call automagically get the ID of the resource you’re nested under. The route helpers reverse-merge in the parameters of the request.

This means if you have these routes:

resources :magazines do
resources :ads
end

and you’re in an action in the ads controller, nested under magazine 5, you can do this:

edit_magazine_ad_path

without passing in a magazine object. It will pull magazine_id 5 out of the request parameters.

  • (1..100).grep 38..44

results in

[38, 39, 40, 41, 42, 43, 44]

As per ruby enumerable docs.

This is because grep uses threequel, which on a range is defined as inclusion. Answer courtesy of Giles Bowkett

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Brent Wheeldon

[Standup][NYC] 6/5/2012

Brent Wheeldon
Tuesday, June 5, 2012

Help

“What are the reasons for using to_s vs to_str vs to_string“

Dave suggested to_string is for Java developers. Cathy will look into this more today and report back.

Interesting

  • Using jasmine’s pretty-print with ember.js was causing the browser to crash as it was recursively going through the object graph trying to construct a string representation of the object. Defining Em.Object.Prototype.jasmineToString() to return this.toString() fixed this.
  • We were having trouble screen sharing to some of the mac minis connected to the TVs, the screen sharing app would hang on “receiving first screen”. The fix for this is to command+k from finder and enter vnc://machine-name
  • Bootswatch is cool. It contains a bunch of different styles for Bootstrap.
  • Corey Innis has a fork of bootstrap which removes classes like span12
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Joelle Gernez

Standup][SF] 06/04/12: Crash and protection

Joelle Gernez
Monday, June 4, 2012

Helps

  • Random phantomjs crashes on ci

Phantomjs crashes randomly when running our test suite on CI, but not locally.

Possible leads:
Seen similar issues on Ubuntu but not on Mac.
Try building phantomjs from source.

Interestings

  • Model.create({attrs}, without_protection: true)

There is a new way in rails 3 to turn off attr_accessible checks – just pass without_protection: true in as a parameter after your attrs. WTF.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Will Read

Executable Documentation

Will Read
Sunday, June 3, 2012

I try to avoid writing static documentation. It gets old and out of date as soon as the next person comes along because it is logically far away from the code it describes, so event the best intended developers won’t always be aware of the documentation dependencies. Since working at Pivotal I’ve enjoyed writing tests first with RSpec, which results in one form of executable documentation to describe behavior to other developers working in the code base. But what about when you need to express behavior to people outside of your code base? Maybe your stakeholders have a company requirement of documentation, maybe you’re trying to entice third party developers to use your new HTTP API, or maybe you just want people to install your gem, what then? Your audience matters, and there’s a variety of tools out there to use depending on your needs.

Human Readable

Cucumber is one tool that can be used to fill this need. It’s designed to be a DSL for creating DSLs to describe your application. It has a nice attribute that it is very human readable. You can then use tools like Relish to publish docs from your Cucumber suite. The drawback is that you put a lot of effort in to expressing what you want in English, which is great if you’re really showing this to non-technical people, but it can be an over optimization if your readers have some technical context.

Dev Readable

In the case where your audience is an outside developer, something like rspec_api_documentation might be more appropriate. It layers on a DSL to your familiar RSpec DSL that lends itself to HTTP APIs. This is great because your RSpec tests become more expressive without the overhead of defining the DSL yourself. From there, you run a rake task to generate HTML. Your spec runs will fail if your docs get out of sync, which should be never if you have CI. The web is an easy venue to consume this kind of information, but the tool doesn’t let you editorialize much beyond the description of the resource and the parameters.

The Best of Both Worlds

One of our open source projects here at Pivotal Labs is Jasmine, a JavaScript testing framework that runs in the browser. Unlike Rspec where you need to have ruby installed and a database set up and so on, everyone has a browser. Check out the jasmine docs and scroll to the bottom. That’s right, the examples are tests, the comments are close to the tests so when the test fails you know to update the text as well, and now someone has a working example of how to use Jasmine all in one. The page itself is generated using Rocco, a Ruby port of Docco.With the combination of docs generated from tests, and tests that run in the browser you get this perfect blend of readable, easy to maintain documentation that is available to your entire audience.

Sometimes you have to provide documentation, but that doesn’t mean it has to be outdated. By creating executable documentation you can have confidence that the code and docs are staying in sync. Consider your audience carefully when choosing how you will document your software and know that there are more than a handful of options available, one of which will probably suit your task well.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Dmitriy Kalinin

June 1st, 2012: National Donut Day

Dmitriy Kalinin
Friday, June 1, 2012

Helps

  • Sprockets fail in CI, not locally?

No answer.

Interestings

  • capybara-webkit has non-standard awesomeness

https://github.com/thoughtbot/capybara-webkit#non-standard-driver-methods

Things like:

  • driver.resize_window
  • driver.console_messages
  • driver.render to get an image of the viewport. inorite?
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Dmitriy Kalinin

Standup May 31st, 2012: Thursday

Dmitriy Kalinin
Thursday, May 31, 2012

Interestings

  • RVM now supports custom SSL versions

Our project needs OpenSSL > v1.0.0 because we’re trying to sign something with a DSA key. We asked on github and fifteen minutes later mpapis had pushed a change to make it configurable. That’s some of the best open source service out there.

  • Chrome Heap inspector is your friend
  • Backbone Events do NOT get cleaned up

If you declare any events in the events property of a initialize, they prevent your instance from being deleted/GC’d. Use an explicit destroy function that calls this.undelegateEvents()

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Ken Mayer

Deploy strategies for HerokuSan

Ken Mayer
Monday, May 14, 2012

Deploy Strategies

If you look at the network graphs of heroku_san on github, you’ll see a number of branches where the only change is the deletion of the following line from the deploy task:

stage.migrate

If more than a few people are willing to take the effort to fork a gem just so they can delete 1 line, something smells. The reason is that these forkers were using something other than Rails+ActiveRecord+SQL in their project. Some were using Sinatra, others were using Rails, but with CouchDB.

The raison d’ĂȘtre for the heroku_san gem is to make Heroku deploys dirt simple. So, if people are making whole forks to customize the deploy task, we should make it less painful.

Enter strategies

Strategies are an object oriented programming pattern for creating pluggable execution control. Now, there is a new class of objects that inherit from HerokuSan::Deploy::Base. These objects control how deploys are executed for you. The Rails strategy, HerokuSan::Deploy::Rails does exactly what HerokuSan has always done:

  • push to git@heroku.com
  • call rake db:migrate
  • restart

On the other hand, the Sinatra strategy, HerokuSan::Deploy::Sinatra does nothing more than the base strategy:

  • push to git@heroku.com

You can create your own strategies and then configure HerokuSan to use it instead of its default:

Rails 3 projects

Amend your Rakefile:

require 'heroku_san'

class MyStrategy < HerokuSan::Deploy::Base
  def deploy
    super
    # call my own code to do something unique
  end
end

HerokuSan.project = HerokuSan::Project.new(Rails.root.join("config","heroku.yml"), :deploy => MyStrategy)

Sinatra (and other Rack based apps)

Amend your Rakefile

require 'heroku_san'

class MyStrategy < HerokuSan::Deploy::Base
  def deploy
    super
    # call my own code to do something unique
  end
end

config_file = File.join(File.expand_path(File.dirname(__FILE__)), 'config', 'heroku.yml')
HerokuSan.project = HerokuSan::Project.new(config_file, :deploy => MyStrategy)

load "heroku_san/tasks.rb"
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Topics

  • agile (780)
  • rails (113)
  • testing (88)
  • ruby (83)
  • ruby on rails (70)
  • jobs (62)
  • javascript (55)
  • techtalk (44)
  • rspec (38)
  • ironblogger (32)
  • productivity (30)
  • activerecord (29)
  • gogaruco (29)
  • git (28)
  • nyc (27)
  • rubymine (26)
  • bloggerdome (23)
  • mobile (22)
  • process (21)
  • pivotal tracker (20)
  • cucumber (20)
  • jasmine (19)
  • design (18)
  • ios (18)
  • webos (17)
  • objective-c (17)
  • android (16)
  • palm (16)
  • "soft" ware (16)
  • fun (15)
  • tracker ecosystem (15)
  • ci (15)
  • cedar (15)
  • rails3 (14)
  • performance (14)
  • bdd (14)
  • gem (13)
  • css (13)
  • tdd (13)
  • selenium (12)
  • goruco (12)
  • bundler (12)
  • meetup (11)
  • railsconf (11)
  • nyc-standup (11)
  • capybara (10)
  • mac (10)
  • mojo (10)
  • chef (10)
  • api (10)
Subscribe to agile Feed
  1. ←
  2. 1
  3. ...
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13
  9. 14
  10. 15
  11. ...
  12. 78
  13. →
  • 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 >