February 2012
1 post
1 tag
Namespace collisions in Ruby and Rails
In trying to test a model named Have using rspec, I ran into a problem because rspec defines its own Have class in Rspec::Matchers::Have.
After much googling, it turns out that ::Have explicitly references the top-level namespace’s Have class, which is what I wanted in this case.
Hopefully this saves someone an hour or two.
November 2011
4 posts
Giving it Away: How Free Music Makes More Than... →
derekwebb:
Music matters. It’s so integral and pervasive in our culture that it almost feels invisible. It’s even hard to imagine walking into almost any store without hearing music overhead. Culture provides a constant soundtrack to our lives. So it’s no wonder there’s so much discussion and debate…
What I Miss About Counter-Strike →
Order isn't guaranteed in JavaScript object...
var o = {a: 1, b: 2, c: 3};
delete o.b;
o.b = 4;
for (k in o) {
if (o.hasOwnProperty(k)) {
console.log(k);
}
}
Since the iteration is over a vanilla object, there is no guarantee for the order of the iteration.
As a result, the output of the above code depends on the browser. Chrome prints “a b d c”, while IE prints “a b c d”. Neither is right or wrong.
If...
1 tag
Fun With JavaScript's Date
new Date(2011, 11, 14).getDate() # => 14
new Date("2011-11-14).getDate() # => 13
Huh? What’s going on here.
While I don’t know for sure, my best guess is that the first form of the constructor simply assigns this.year, this.month, and this.day with the provided values. That’s why the return value is what you’d expect.
The second form, however, seems to be parsing...
October 2011
7 posts
Ellie Goulding - "Lights" →
coffee-roaster →
This is a simple tool I wrote to work with Coffeescript. It watches a directory or file for .coffee files with “#@compileTo outputFile” directives, and compiles those files when they change.
Use it by running “coffee-roaster src/”.
Two Months Of CoffeeScript
Working With CoffeeScript
Since joining the Shopify team in early August, I have been working on Batman.js, a single-page app micro-framework written purely in CoffeeScript. I won’t go into too much detail about what CoffeeScript is, because I want to focus on what it allows me to do.
Batman.js has received some flack for its use of CoffeeScript, and more than one tweet has asked why we...
September 2011
2 posts
Are Jobs Obsolete? →
The question we have to begin to ask ourselves is not how do we employ all the people who are rendered obsolete by technology, but how can we organize a society around something other than employment?
Sitting is Killing You →
August 2011
5 posts
5 tags
Batman: Fighting crime and kicking apps →
thechangelog:
Batman.js from Shopify is a extremely slick looking framework for building single page apps in Node.js.
Batman lets you define observable events on your objects via the @event macro.
class Gadget extends Batman.Object
constructor: -> @usesLeft = 5
use: @event (times) ->
return false unless (@usesLeft - times) >= 0
@usesLeft -= times
You can then observe...
Not Exactly A Running Start
The move to Ottawa is off to a false start.
We arrived in the city on Sunday night and checked into a hotel. Monday was spent searching for apartments. Tuesday was my first day at Shopify. Wednesday was a sick day. Thursday was a groggy blur, and today is another sick day.
Sending emails to excuse myself from work on two of my first four days is not exactly hitting the ground running. I hope to...
July 2011
8 posts
AirBnB Fiasco Summary
I’ve found myself eagerly following the the drama surrounding the AirBnB fiasco. The story seems to have it all: a brave heroine struggling against the odds, a start-up bound for success hitting its biggest hurdle yet, and the media circling overhead waiting for blood.
Here’s a quick rundown of events so far:
AirBnB host gets her place trashed by some asshole(s) and writes a blog...
The Brilliance of Dwarf Fortress →
Tarn sees his work in stridently ethical terms. He calls games like Angry Birds or Bejeweled, which ensnare players in addictive loops of frustration and gratification under the pretense that skill is required to win, “abusive” — a common diagnosis among those who get hooked on the games, but a surprising one from a game designer, ostensibly charged with doing the hooking. “Many popular games...
$22 Billion in Gold, Diamonds, Jewels Found In... →
“Truth is stranger than fiction.” - Mark Twain
Reed Hastings' Netflix Culture Deck →
Reed Hastings calls out process-heavy cultures and values high-performance employees.
June 2011
7 posts
dotjs is Greasemonkey the way it was meant to be →
3 tags
A simple jQuery namespacing function →
Introducing the $.namespace function! It takes a string and gives you a global representing the namespace you want. For example,
$.namespace("Causes.Earn.Dialog") => {Earn: {Dialog: {}}}
This gets rid of crufty code like:
if (!Causes) { Causes = {}; }
if (!Causes.Earn) { Causes.Earn = {}; }
Allowing you to simply call:
$.namespace("Causes.Earn");
Causes.Earn = ...
In case you’re...
2 tags
Bufr Overflow: Please, make yourself... →
bufr:
Here’s me at any given weekday around noon:
I’m staring at some code usually written by some French guy back in 2003. After I curse the French, I refactor a chunk and restart my server, alt-tab over to my browser, immediately command-T and type ‘r-e’ until reddit.com appears in my omnibar, browse…
tumblrbot asked: WHERE WOULD YOU MOST LIKE TO VISIT ON YOUR PLANET?
November 2009
3 posts
The best TV series of the ’00s | The A.V. Club →
“SuperFreakonomics” and climate change →
1 tag
Study: Feeling grumpy 'is good for you' →
October 2009
20 posts
BBC: The map that changed the world →
Pollution in China →
This makes me question whether any amount of “green” shit I do makes any difference whatsoever.
Software Design Review →
Great article on the software planning process.
jQuery Approach →
Don't talk to cops →
A law professor and a police officer give a lecture about why you should never talk to the police.
Good News on Wall Street Means… What Exactly? -... →
Backslash: web creator Sir Tim Berners-Lee... →
“Sir Tim Berners-Lee, who wrote the code that transformed a private computer network into the web two decades ago, has finally come clean about the about the infuriating // that internet surfers have cursed so frequently.”
Infuriating? Really?
A Farewell to ORMs? →
Good discussion on ORMs.
Small change: Does ‘microlending’ actually fight... →
“The picture that emerges is not of people climbing out of poverty through microenterprise, but people doing what they need to to get by,” says David Roodman, a microcredit expert at the Center for Global Development.
Get your swag back daddy, where your focus at?
– Jay-Z - Kingdom Come