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
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

what, CI Reporter?

Max Brunsfeld
Thursday, October 18, 2012

Helps

  • iPad/iOS – full page redraws

iOS devices do a full-page redraw when we introduce new height at the bottom of the page or when backgrounding/foregrounding the browser. How to avoid that?

  • Jasmine not working when run through jenkins

Jasmine:ci on firefox fails on CI only with the error:

/home/ci/.rvm/gems/ruby-1.9.3-p194@gemini/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok’: ReferenceError: jsApiReporter is not defined (Selenium::WebDriver::Error::JavascriptError)

Anyone seen this? It runs great on the command line when we ssh into the ci box, but fails when run through Jenkins.

Interestings

  • JS – objects on prototypes

In javascript, if you give a prototype an object property, then mutating that object will do so for all instances of the class.

So if you do this:

MyClass.prototype.things = {
  "foo": "cool"
};

var instance1 = new MyClass(),
instance2 = new MyClass();

instance1.things["bar"] = 5;

then

instance2.things["bar"] === 5
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

No go on #nogo

Max Brunsfeld
Wednesday, October 17, 2012

Helps

  • #nogo links triggered on Firefox 15.0.1

We are using jqeury-ui-selectmenu and on some menus, selecting from the menu routes to the embedded href in the link (#nogo) instead of triggering the handlers. This is only a problem on firefox 15.0.1+.

Interestings

  • UTF-8 encoded emails in ActionMailer

We ran into a problem with incorrectly encoded UTF-8 characters in emails generated by our rails app.

We spent a few hours investigating this. It turns out the premailer-rails3 gem we were using for CSS inlining was at fault. We switched to the actionmailer_inline_css gem, which handles UTF-8 properly.

This is likely to be an issue for any Rails 3 site that puts user generated content in email templates (names, etc).

-Maksim

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Super secret special standup

Max Brunsfeld
Monday, October 15, 2012

Interestings

  • Interested in speaking at the East Bay Ruby Meetup?
    Ruby-81 meets near on campus at Cal and is looking for speakers. It’s a great place to get started with professional public speaking.

  • iOS6′s super aggressive caching
    IOS6 apps will now much more aggressively cache http requests, even POST requests! This can trip you up when upgrading, so be prepared to add cache settings to your AJAX requests.

http://stackoverflow.com/questions/12506897/is-safari-on-ios-6-caching-ajax-results

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][SF] 5/17 – we approve of the juggernaut

Max Brunsfeld
Thursday, May 17, 2012

Ask for Help

“Is Juggernaut still the best library to use for websockets, long-polling etc?”

The last commit on master was about 2 months ago. One pivotal project is using it, and they approve of it. If you’re on Heroku, you might try their pusher service.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

[Standup][SF] 5/16: Travis CI – Distributed sticker distribution

Max Brunsfeld
Wednesday, May 16, 2012

Ask for Help

  • “Anybody know of good short-to-medium-term housing in SF?
    Try airbnb, ‘vacation rentals by owner’, or homeaway.

Interesting Things

  • If you’re setting up a postgres database using ActiveRecord, and you see an error that looks like this:

    new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

then the problem may be that your template1 database (the default database that postgres copies from when you CREATE DATABASE) is configured to use ASCII, rather than UTF8. Try adding this option to the relevant section of your database.yml:

template: template0

More information about Template Databases in postgres

  • If you donate to Travis CI, then you will receive free stickers.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

A convenient ‘super’ method for Backbone.js

Max Brunsfeld
Monday, January 30, 2012

Inheritance in Backbone

Backbone.js comes with a minimalist OO inheritance framework similar to the one employed by CoffeeScript. Each base class has a static method called extend that is used to create a subclass, like this:

User = Backbone.Model.extend({
  // instance methods
},
{
  // class methods
});

extend returns a constructor whose prototype inherits from Backbone.Model.prototype. References to all of Backbone.Model’s static methods and properties (including extend) are copied to the new constructor.

Calling ‘super’

The constructor also receives a __super__ property, which references its superclass.

User.__super__ === Backbone.Model.prototype

This makes it possible to call super inside of a class or and instance method:

User.prototype.save = function(attrs) {
    this.beforeSave(attrs);
    User.__super__.save.apply(this, arguments);
};

CoffeeScript has a super keyword that compiles to the line above, but when using Backbone with plain javascript, its a little grating to have to type that out.

A small layer of convenience

I wrote this little super method (test-driven using jasmine) which saves me having to repeat the constructor’s name all over the place. You call it like this:

User.prototype.save = function(attrs) {
    this.beforeSave(attrs);
    this._super("save", arguments);
};

The second parameter to _super is the array of arguments to pass to the overridden method. This is to optimize for the common case of passing the arguments object straight through.

There’s no way to avoid having to repeat the method name like that, unless you wrap every method definition with a helper function that either passes the overridden method as a parameter (a la Prototype.js) or reassigns a hidden super property behind the scenes (like JS.Class or John Resig’s approach). These approaches won’t work with Backbone’s ultra-minimalist inheritance system.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 8/26/2011

Max Brunsfeld
Saturday, August 27, 2011

Interesting Things

  • Radio buttons behave strangely when they have no ‘value’ attribute. If you had a form containing a tag like this:

<input type="radio" name="foo" /> (no value attribute),

and you selected that radio button, then the POST data will contain foo=on. The default value is not an empty string, but the word “on”.

You might run into this problem using rails form helpers. If you pass a nil value to ActionView’s radio_button_tag method, it will render a tag without a ‘value’ attribute, so the string “on” might show up in your params.

  • Watch out for old middleware that expects the :body method of a Rack::Response to return a string. In newer versions of rack, the method returns an enumerable. We ran into this problem with an old version of pdfkit. It’s fixed in the new version.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 8/24/2011

Max Brunsfeld
Wednesday, August 24, 2011

Ask for Help

Cocoa applications can be made scriptable with AppleScript. Unfortunately, nobody at the office this morning had experience with this.

Interesting Things

SF Pivots should check out the free PCs in the ops area. These were cutting edge linux development machines several years back, and now they and there parts are up for grabs!

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 8/22/2011

Max Brunsfeld
Monday, August 22, 2011

Ask for Help

“Is there a Ruby Gem that will take a string of code and identify what programming language it’s written in?”

Github has a gem called Linguist, but it doesn’t identify the language by parsing it. It uses file extensions, hash bang lines, and looks for the presence of certain keywords in the code.

“Should Akamai be used with, or as a replacement for varnish?”

Akamai is a complete replacement for varnish.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Max Brunsfeld

Max Brunsfeld
San Francisco

Subscribe to Max's Feed

Author Topics

backbone (1)
javascript (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • 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 >