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

Let us know how we can contact you.

Thank you!

We'll respond shortly.

PIVOTAL LABS
Standup 5/13/2010

Interestings

Webtoolkit Base64 encoding is wrong

If you need to do Base64 encoding/decoding in JavaScript, you likely came across this link (as it’s the #1 Google hit for: “base64 enocde javascript”):

http://www.webtoolkit.info/javascript-base64.html

This code (for encode) works just fine as long as you’re only dealing with strings whose contents are plain ASCII test (no high bits set).

But this code does a UTF encode before the Base64 encode. Which means that any characters with the high-bit set will get expanded first and your Base64 encoding will be wrong. For example, if you build a SHA1 encoded string and then Base64 encode it, you’ll get a resultant string that’s longer than the expected 28 bytes.

Our solution was to keep Googling around until we found some JavaScript Base64 code that did not do any Unicode expansion. Here’s one that does the right thing – there are more, but are hard to find:

http://nerds-central.blogspot.com/2007/01/fast-scalable-javascript-and-vbscript.html

Factory Girl after_create

You might want to use factory_girl to create an object that includes another object. If both factory methods make use of the after_create callback the child’s after_create will be called before the parent’s. This behavior might seem unintuitive and you should keep this in mind working with factory_girl.

Ruby Mine running focused tests from inside context

It turns out that having shoulda anywhere in your project will break running focused tests from inside a context. This will also break ii you use a plugin that comes with shoulda.

Ruby Mine commit & push

Ruby Mine’s behavior when using commit together with the push option might not behave as expected. For us it merged a branch and truncated all changes that had occurred on that branch since the last update.

WebKit JS treats “export” as keyword

One of the many unused keywords in JavaScript is “export”. Firefox lets you use it since it’s de facto unused. However, using “export” in your JavaScript will break your code in WebKit-based browseres.

Comments
Post a Comment

Your Information (Name required. Email address will not be displayed with comment.)

* Copy This Password *

* Type Or Paste Password Here *