HNHacker News
TopNewBestAskShowJobs

TrevorBurnham

1,926 karma · joined September 14, 2008

I'm the author of the CoffeeScript book from PragProg: http://pragprog.com/titles/tbcoffee/coffeescript

And, recently, Async JavaScript: http://leanpub.com/asyncjs

I'm available for freelance work on exceptionally interesting projects. I live in Cambridge, MA.

Website: http://trevorburnham.com/

Email: trevorburnham@gmail.com

submissionscomments
TrevorBurnham··on Unique Error Phrases
Excellent! Thanks.
TrevorBurnham··on Unique Error Phrases
Love it. Someone please write a Node.js library for generating these.
TrevorBurnham··on Processing CoffeeScript Editor
Hit ctrl+r (on a Mac) to toggle between the code and the visualization. Really cool, though a two-pane approach (code on the left, visualization on the right) would probably be more useful.
TrevorBurnham··on Kendo UI - a framework for modern HTML UI
Good to know. I've gotta say, the jQuery UI Datepicker is just perfect. If I use jQuery UI on a site, it's almost certainly just for the Datepicker.
TrevorBurnham··on Kendo UI - a framework for modern HTML UI
It appears to be more oriented toward enterprises, who'd be happy to license this just for internal web apps. You've got Grid and Chart widgets (must-haves for internal sites that show business data), but no Datepicker (a must-have for consumer-facing sites).
TrevorBurnham··on Kendo UI - a framework for modern HTML UI
That link just takes me to an error page. The FAQ says "Kendo UI is dual-licensed, Commercial and Open Source (GPLv2)"—and furthermore, that "During the Beta phase, no commercial license is available."

[Edit: Updated link did work. Yeah, that license agreement is... not GPL-compatible. I'm guessing they duplicated the same boilerplate that they use for trial versions of their .NET libraries.]

TrevorBurnham··on Kendo UI - a framework for modern HTML UI
I'd seriously consider using this, just because of the stagnancy of jQuery UI. It's a massive project with hundreds of long-open tickets (despite thousands of dollars spent on incentivizing developers over the summer through http://rewardjs.com/). 1.8 was released in March of 2010, and the last milestone release for 1.9 was back in May.

To be fair, a lot of jQuery UI's development headaches come from supporting IE6, while Kendo only touts its support for IE7+...

TrevorBurnham··on CoffeeScript comprehensions are broken
Despite its linkbait title, this is one of the more thoughtful pieces on CoffeeScript that I've seen in a while. The behavior of nested list comprehensions in CoffeeScript has been the subject of much debate, and the excellent Coco fork adopts the Python-esque behavior.

However, I think the objections here would be moot if CoffeeScript's "list comprehensions" were called something else. They don't behave like list comprehensions in Python, but their behavior is perfectly consistent with the CoffeeScript philosophy that every expression has a value, and loops are expressions. That means that a single loop has a single list as its value, and a loop within a loop produces a list of lists. Note that unlike Python—or Harmony—there's no special delimiter to say "Give me a list comprehension." It's just the natural implication of how expressions in CoffeeScript work.

TrevorBurnham··on Why the Rampant Fanboyism Around CoffeeScript Worries Me
Ha, your comment made me wonder momentarily if the essay was a work of post-modern art, subversively advertising the benefits of CoffeeScript through an implausible flourish of logorrhoea. If so: Well done, sir.
TrevorBurnham··on Why the Rampant Fanboyism Around CoffeeScript Worries Me
At one point, the author writes:

> OK im done ranting at invisible Brendan Eich now (as if hes going to read this) :-)

Write a more cogent piece, and he will. I'm amazed at how generous Brendan is with his time. He responds to tweets, and to numerous comments on his blog. When I asked him to look over the part of my CoffeeScript book that deals with the history of JavaScript, he not only did so, he also offered technical corrections and suggestions pertaining to other parts of the book. Just today, he took to HN to participate in a vigorous discussion of Google's forthcoming Dart language: http://news.ycombinator.com/item?id=2982256

In short: Rather than using the creator of JavaScript as a strawman in a meandering diatribe (one that's 3,700 words long and yet "only 1/3 done"), you should try to organize your thoughts and engage with him.

TrevorBurnham··on Fox.js: Create HTML tables from ASCII art
Source is at https://github.com/jamesgpearce/foxjs
TrevorBurnham··on Fox.js: Create HTML tables from ASCII art
Really unbelievably cool. And that last example has me thinking that it's practical enough for real-world applications—the diagram is just so much more self-documenting than CSS or a series of jQuery calls could ever be.
TrevorBurnham··on Rich Tax Breaks Bolster Makers of Video Games
The article is a bit complicated, centering on an array of tax provisions that favor EA, but there are some fascinating tidbits:

> In 1981, as Americans worried that Japan’s growing dominance in the auto business would be followed by a decline of the high-tech industry in the United States, Congress added another research and development credit, this time specifically for companies that increased their R.& D. spending from the previous year...

> Within a few years, the credit was being claimed by businesses with little technological background — fast-food restaurants, hair stylists and fashion designers. So Congress tried to restrict what research would qualify. The credit was denied for social science research and marketing...

> The failed attempts to restrict the R.& D. credit to basic research have been a boon for video game companies. Even when companies are merely creating new versions of existing games — conducting research that would have little value to anyone but themselves — their development processes usually involve enough experimental uncertainty to qualify for the tax break.

TrevorBurnham··on CoffeeScript: JavaScript without the Fail (slides)
> I worry the compression, while cute, could start to get a little extreme after a while

Not my experience. I love how short my code is. http://www.paulgraham.com/power.html

> there seems to be some interesting inconsistencies

Yeah, there are. These bug me less now than they did initially. Like any language, you have to know it well to use it well. But there's much less that you need to know about CoffeeScript than about, say, Ruby or Python. CoffeeScript's feature set is small enough that you can master it very quickly.

> is there a clear unambiguous grammar for it anywhere?

https://github.com/jashkenas/coffee-script/blob/master/src/g...

TrevorBurnham··on CoffeeScript: JavaScript without the Fail (slides)
I think JavaScript gets many things right, but has an overly verbose syntax. So CoffeeScript hits a sweet spot by adding syntactic sugar while hewing close to the underlying language.

You and Alanis Morissette may call that ironic. I'd call it practical.

TrevorBurnham··on CoffeeScript: JavaScript without the Fail (slides)
The slap at Brendan Eich is very tongue-in-cheek. Much is made of his lack of beard, but the caption "Beard Myth Busted!" appears a few slides later.
TrevorBurnham··on Why I'm (Finally) Switching to CoffeeScript
> CoffeeScript can work alongside Node.js but can't access the filesystem.

Um. Node.js gives you access to the filesystem... http://nodejs.org/docs/latest/api/fs.html

And anything you can do in Node, you can do from CoffeeScript code running under Node.

TrevorBurnham··on Why I'm (Finally) Switching to CoffeeScript
Well, there was a related inconsistency which was certainly a bug. And it's now fixed: https://github.com/jashkenas/coffee-script/issues/1669
TrevorBurnham··on DevDays 2011 is Cancelled
This is a particularly big disappointment for me: Not only was I scheduled to speak at the London event, but there were to be talks on CoffeeScript in all four locations. While CoffeeScript talks have become de rigeur at Ruby/Rails events, Dev Days presented an opportunity to bring the language to a wider developer community. Plus, the talks were going to deal with more advanced topics than the usual "Here's why you should learn CoffeeScript." My talk was cheekily entitled "CoffeeScript: The Only Language You'll Ever Need"; I was planning to talk about tricks and tools for using CoffeeScript in all walks of life.

Of course, my sympathies go out to the Dev Days planners; this must have been a very hard decision for them, and an understandable one. Consider me RSVP'd for Dev Days 2012.

TrevorBurnham··on Mecury Editor: A rails wysiwyg editor built with coffeescript
Wow, this is really cool. (Click the "Test it out" button.)

If I understand correctly, the idea is that you could set this up on a Rails project so that your team's copywriter would be able to edit your site's content directly on the page, rather than having to edit some ERB or Haml somewhere and refresh.

TrevorBurnham··on Keymaster.js: painless keyboard shortcuts for javascript
In case anyone wants it, here's my unicode-friendly fork of jQuery Hotkeys: https://github.com/TrevorBurnham/jquery.hotkeys

Note that because of the way the library works, you can only use the unicode equivalents on this fork—aliases like "ctrl" and "alt" will not work. (jQuery Hotkeys was written with a pretty hardcore approach to efficiency, so everything is 1:1. Keymaster uses an `indexOf` search each time a key is pressed, which has a negligible impact on performance in modern browsers.)

TrevorBurnham··on Why I'm (Finally) Switching to CoffeeScript
CoffeeScript and Node.js get along fantastically. When the "coffee-script" library is loaded, you can even "require('foo.coffee')" directly, making it easy to mix-and-match JavaScript and CoffeeScript files.

Sam Stephenson, the creator of Prototype.js, has been doing all kinds of awesome things with CoffeeScript and Node.js. And there's a chapter of my book on it...

TrevorBurnham··on Why I'm (Finally) Switching to CoffeeScript
Some nice examples, if a bit unfair since the JS is clearly compiled from the CoffeeScript rather than hand-coded. In fact, the last example reveals a bug in CoffeeScript—the function

    (x, y) ->
      for game_piece in @game_pieces
        if game_piece.is_at x, y
          @held_item = game_piece
          @held_item.start_dragging x, y
          break
compiles to

    function(x, y) {
        var game_piece, _i, _len, _ref, _results;
        _ref = this.game_pieces;
        _results = [];
        for (_i = 0, _len = _ref.length; _i < _len; _i++) {
          game_piece = _ref[_i];
          if (game_piece.is_at(x, y)) {
            this.held_item = game_piece;
            this.held_item.start_dragging(x, y);
            break;
          }
        }
        return _results;
      }
Notice that _results is initialized as an empty array... and is never modified, making it an utterly pointless return value. What's happening is that the CoffeeScript compiler has both implicit returns and list comprehensions, which means that it tries to return an array of all the values in the loop. All well and good, but the compiler doesn't try to do a list comprehension when there's a break... and yet it creates the frivolous _results variable anyway.

Obviously I'm a fan of CoffeeScript; this is a minor bug and I expect it to be fixed. But let's be fair in making the case for it. Well-written JavaScript will always look better than CoffeeScript output; it just takes a lot more work.

TrevorBurnham··on We open-sourced 90 node.js modules at Browserling
Most of these are small utilities (e.g. node-mkdirp), but a few are really significant contributions to the Node community. node-bigint, for instance, is a very robust, efficient library for doing infinite-precision arithmetic (a fairly common necessity, since every number in JavaScript is a 64-bit float and there's no way of knowing when you lose precision).
TrevorBurnham··on The Secret Life of JavaScript Primitives
True. I'd argue that it's the best of both worlds: Unlike Java, you have access to a bunch of helpful functions on every primitive, and you can add more by modifying prototypes; and unlike Ruby, primitives are immutable, which puts a cap on the level of complexity (you could write a whole book on Ruby's string objects).
TrevorBurnham··on Linux is now hosted on GitHub
I think Github's issue tracker is the best around, now that search actually works. Very lightweight, and the integration with commits and pull requests is really nice.

dhh doesn't sound like he was ever a fan of Lighthouse: https://twitter.com/#!/dhh/status/63366853636009985

TrevorBurnham··on Sideline, a CoffeeScript shell for your server
Looks really nice and simple. Would've been great to have for Node Knockout.
TrevorBurnham··on The Patent Pledge
True.

Incidentally, for those who are curious, the three patents used against Fototime (as well as more established companies like Flickr) can be found at http://www.google.com/patents?id=uiAPAAAAEBAJ, http://www.google.com/patents?id=0J8DAAAAEBAJ, and http://www.google.com/patents?id=-QEWAAAAEBAJ. The first two actually feel substantial and specific (probably too specific for Fototime to have been infringing); the third one is just a simple database schema and a flowchart, which is madness (though it, too, is so specific that it's unlikely that anyone was actually infringing).

TrevorBurnham··on The Patent Pledge
I think the idea is that if the company is successful enough to have grown to 25 employees, it stands a better chance of having access to competent legal counsel and other resources. The penalty might be bigger in monetary terms, but smaller in terms of making the founders' lives a living hell.
TrevorBurnham··on The Patent Pledge
The recent This American Life ep "When Patents Attack" (http://www.thisamericanlife.org/radio-archives/episode/441/w...) started with a segment on a startup called Fototime, which was very small (certainly under 25 people) and had to settle a patent suit at great expense. (As part of the settlement agreement, they aren't allowed to say how much; only that it was just short of what would have caused them to file for bankruptcy.)
← PreviousPage 2 of 11Next →