Tuesday, April 23, 2013

Music-Generating Swings In Montreal

Sunday, April 21, 2013

New Track On SoundCloud: "Willfully Obtuse"

It's a leftfield drum and bass track with an indie rock feel to it.

Probably very influenced (unintentionally) by this Diiv song.

Thursday, April 11, 2013

A Hello World In Ember.js

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:

Rewind: Analyzing Git History With Bash

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.

How I Made ~2,340% Profit With Bitcoin And Trivial Code

The other day, right before the latest Bitcoin price spike crashed, I sold half a Bitcoin for about $117.89. I had bought this Bitcoin for about $10, so I think my math is very approximately correct when I call that a 2,340% profit. A 100% profit on a $5 investment would have been another $5.

In other words, I sold at the height of a bubble. Lucky me. But the answer is not just luck. The answer is shell-scripting the web.

Two years ago, I wrote a simple Ruby script to screen-scrape Bitcoin prices (in USD) and create a simple web page with the latest price. Then I plugged that into an hourly cron job and wired up the DNS for btcusd.gilesb.com. I didn't do it because I actually cared very much about Bitcoin prices. What I did care very much about was not looking at the hideous price-tracking web sites which existed at the time. I was too used to plugging my currency conversions into Google searches, but you couldn't do that for Bitcoin yet at the time (and maybe you still can't).

However, after I built this little mini-app, because of a very useful side effect, I saw its one tiny web page every single day, several times a day, and in the process developed a very detailed intuitive feel for the volatility of Bitcoin prices. And then, when I sold my Bitcoin, I just happened to do it very close to the peak of the latest bubble. Coincidence?

Here's how the side effect happened. At the time I wrote btcusd.gilesb.com, Safari was my only web browser on my iOS devices, and iOS Safari has a number of very poorly-conceived quirks, the worst being that any time you open it on an iPhone, it will idiotically jump to your Bookmarks, as if bookmarks were a feature which normal people ever even use. I began developing muscle memory for the task of closing the bookmarks and switching to the search field, but it struck me what a terrible maladaptation that was, so I decided to do something else instead.

I developed a simple habit for my iPhone of always keeping a web page open which had a simple DOM and a very fast page-loading time. (DOM simplicity can be more important than actual network loading speed when it comes to perceived performance.) I chose Hacker Newspaper for this purpose.

Hacker Newspaper is a miniapp like btcusd.gilesb.com, but for Hacker News, which I had written a few years earlier. I wrote it because Hacker News makes (in my opinion) terrible and obvious mistakes in typography, color theory, and web application performance, as well as terrible but subtle mistakes in application design. Anyway, Hacker Newspaper loads very quickly and renders very quickly, because it features a simple DOM, and very few external assets, so it got me around the usability fail in iPhone Safari. But btcusd.gilesb.com loads and renders even more quickly, with an extremely simple DOM, zero external assets, and also zero distracting links, so I made that my default launch page for Safari on the iPhone instead.

That was in 2011. It's 2013. I've seen the Bitcoin price fluctuating nearly every day since then, sometimes very many times per day. I've never given it a lot of attention, but I didn't have to. I've developed an enormous amount of context for Bitcoin prices as a side effect. (This is why I firmly believe you have to be judicious about what information you consume, both actively and passively.)

Anyway, my massive profit percentage is in fact just a tiny sliver of actual dollars. However, what I plan to do is continue using btcusd.gilesb.com this way, and buy BTC again when I feel they've hit a low. I'm willing to trust my intuition in this regard because I've developed it against a lot of data. Although this is just intuition, I expect the price to dip quite a bit at some point in the future, and I have very logical reasons to expect that I'll be among the first to know if/when that happens. Having tested this system with a small amount of money, I'm willing to experiment with a larger amount next time.

Of course this is not financial advice, and although I think some sane solution for Bitcoin and taxes will emerge, this is not legal advice either. But it is programming advice. You should shell-script the web. Hacker News annoyed me, so I fixed it with a tiny mini-app, really not much more than a shell script. Google didn't extend its automatic currency conversion to BTC, so I fixed that with a tiny mini-app too, again not much more than a shell script. And then I used that shell script mini-app to avoid Apple UX fail, and made an absurd profit percentage as a side effect.

Shell script all the things. The web is full of broken. Fixing even the little problems can accidentally net you huge profits.

Saturday, April 6, 2013

Friday, April 5, 2013

Your Periodic Reminder That Silicon Valley's Perceptions Are Skewed

Earlier this year Chris Dixon wrote what is mostly a good blog post, but sadly also a classic of blind northern California arrogance:

What the smartest people do on the weekend is what everyone else will do during the week in ten years...

Engineers vote with their time, and are mostly trying to invent interesting new things. Hobbies are what the smartest people spend their time on when they aren’t constrained by near-term financial goals...

Today, the tech hobbies with momentum include: math-based currencies like Bitcoin, new software development tools like NoSQL databases, the internet of things, 3D printing, touch-free human/computer interfaces, and “artisanal” hardware like the kind you find on Kickstarter.

It’s a good bet these present-day hobbies will seed future industries.

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.

For instance, consider the Oscar-winning actress and budding director Natalie Portman, who first published her scientific discoveries in peer-reviewed journals while in high school. If she spends her free time geeking out about Bitcoin, Dixon's rule applies to her. If not, then either Dixon's rule is silly, or she is not one of the smartest people out there. But that would mean winning the top award in one of the most competitive fields in the world, attending Harvard, and publishing in scientific journals while essentially still a child would not be reliable indicators of high intelligence, while selecting a hobby which went on to become a big business would be a reliable indicator of high intelligence.

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.

It's good to pay attention to what the startup community talks about. You just need to take it with a grain of salt.

Thursday, April 4, 2013

Snippet: Drum & Bass w/String Section

A little variation from the norm; more melody than usual for me.