Sunday, April 14, 2013

Thursday, April 11, 2013

I saw several blog posts with inaccurate code for a 'hello world' in Ember. Here's code which actually works:

Loading this file gets you an "index" (default) view with a "hi" link, and clicking that link gets you to "hello world!".

I'm a little embarrassed about 'index' as a naming choice, because it's a bad habit, but I got it from the framework. Ember uses 'index' to mean 'default view,' the same way Rails controllers do. This probably came to Ember from Rails, and came to Rails from Apache, but it really has nothing to do with indexing whatsoever. It's one of the few completely cargo-cult elements in Rails, so it's not my favorite part of Ember either.

However, one thing I do want to give Ember credit for, which you can see in this example: this code's concise. In fact it could be a lot more concise; that 'index' route doesn't actually need to be there. Like a lot of things, Ember supplies it automatically.

So this is better:

And also:

@gilesgoatboy you can leave off the { path: ‘/hi’ } and the nested function in your final example and everything will still work :D

Rewind is a small library of git analysis scripts in Ruby and bash. Its goal is to quickly extract meaningful context from the enormous amount of historical data which any git project provides.

One use case: you want to compare the respective authorship patterns of two forks of a library from GitHub. Maybe your company has a local gem forked from a popular gem, and you want to figure out how many unique changes your fork has.

Another use case: you're looking at a large library with a lot of files, and you've been told this library has a lot of technical debt. One way to track down technical debt is to find the files which a) have the largest number of lines of code, and b) have the largest number of commits. Conversely, if you see a very small file with a very large number of commits in its history, people have probably refactored that file a lot.

Rewind gives you numbers; you have to use good judgement to get useful insights from those numbers.

This statement is true within a bounded territory, but it has two zones of epic fail.

If by "the smartest people" you mean "the smartest young, single geeks in Silicon Valley with time on their hands but no idea how to party," then it's basically true, or close enough. It can even stay mostly true when you broaden it to "the smartest geeks in Silicon Valley."

But if by "the smartest people" you mean "the smartest people in Silicon Valley," you quickly run into the first zone of epic fail. Steve Wozniak did it as a hobby; Steve Jobs did it as a business. So the idea can only be legit if we assume Wozniak was smarter than Jobs. This is not only a dickhead thing to say, it's also extremely debatable.

That same problem becomes much, much more serious in the idea's grander zone of epic fail, which is the world at large. If by "the smartest people" you actually do literally mean "the smartest people," this statement falls from a lofty status of near-flawless truism — which it achieves when isolated to a particular subset of Silicon Valley geeks — down to a nadir of useless and near-total inaccuracy.

It can only be true if none of the smartest people are also uneducated; if none of the smartest people work on the weekend, or go to school on the weekend; if none of the smartest people are beset by war, famine, illness, or other distracting, weekend-filling forms of misfortune; and if none of the smartest people, anywhere ever, like to spend their weekends making music, making art, making films, or volunteering their time to feed the homeless, end various injustices, or make the world a better place in any other non-commercial sense, or indeed just having fun.

It doesn't take long to find many similar examples; and, as an experiment, I just googled "Natalie Portman charity work." Turns out there's enough there to win her another award. I hope she did all that charity work during business hours, because if it happened on the weekend, she's off that genius list.