Close
Glad You're Ready. Let's Get Started!

Let us know how we can contact you.

Thank you!

We'll respond shortly.

Joelle Gernez

Posts By

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

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.

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

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

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

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.

LABS
[Standup][SF] Standup 11/7/2011:Rescue saga

Ask for Help

When a rescue worker is stuck on Heroku (Cedar stack Rails 3.1), spinning up workers increment the total number of workers available but not the number of workers busy.

To clean that up you should be able to unregister workers on the console.

I'd typically go into the console, get the misbehaving >worker and call "unregister_worker" on the instance. It >looks like you might also be able to simply call the >Resque::Worker#prune_dead_workers class method. >Class here: >https://github.com/defunkt/resque/blob/master/lib/resque>/worker.rb