background preloader

CoffeeScript | Javascript/Etc - Languages

Facebook Twitter

Tech Lore - A Skeptic’s CoffeeScript Experience. When my co-founder Jim first came across CoffeeScript, I was skeptical.

Tech Lore - A Skeptic’s CoffeeScript Experience

I had picked up all I knew about JavaScript through hard-earned battle scars. I had won the battle, but I wasn’t ready for a new one. It didn’t make sense to apply a new layer of abstraction, with its own warts and idiosyncrasies, on top of a language that had a lifetime of them on its own. But its syntax *was* much closer to what I’d consider ideal, so like a good nerd, I gave it a run around. It’s been incredible. My initial fears were way overblown.

But I didn’t like it just because it didn’t suck — CoffeeScript pulls off two huge things that it took some time to appreciate. Like many people, my first experience with JavaScript was marked by a general feeling of “Why doesn’t this work the way it looks like it should?” Somewhere around that point in my journey, I read JavaScript: The Good Parts, and everything started to click. . $ -> $('.div1').click -> $('.foo').click => alert $(@).text() — Dan Getelman, CTO (@dget) In Which I Tell You to Stop Whining About CoffeeScript - Adam Singer. CoffeeScript. IcedCoffeeScript. IcedCoffeeScript is a superset of CoffeeScript.


The iced interpreter is a drop-in replacement for the standard coffee interpreter; it will interpret almost all existing CoffeeScript programs. IcedCoffeeScript (ICS) adds two new keywords: await and defer. These additions simply and powerfully streamline asynchronous control flow, both on the server and on the browser. Say goodbye to callback pyramids; say adios to massive code rewrites when synchronization requirements change slightly. Say hello to clean, readable, maintainable control flow for network and asynchronous operations! The golden rule of CoffeeScript was: "It's just JavaScript". Latest Version: 1.7.0-a Installation The CoffeeScript compiler is itself written in CoffeeScript, using the Jison parser generator. To install, first make sure you have a working copy of the latest stable version of Node.js, and npm (the Node Package Manager). Npm install -g iced-coffee-script (Leave off the -g if you don't wish to install globally.) load.

CoffeeConsole: A Chrome Extension. Harry Brundage, a co-worker of mine at Shopify, does a lot of CoffeeScript development and said he would love to be able to do CoffeeScript right from the console in Chrome's Web Inspector.

CoffeeConsole: A Chrome Extension

I asked Paul Irish, a "dev relations guy" at Google, to point me in the right direction on building just such a thing. The result of today's pet project is CoffeeConsole, a Chrome extension that adds a new panel inside the Web Inspector. Type in any CoffeeScript and then hit the run button (or hit Command-Enter or Shift-Enter). The code will be compiled into JavaScript and then run in the context of the current window. I've put together a quick video to demonstrate this. Behind the scenes, I cobbled together a bunch of resources.

There's definitely more features that can (and maybe should) be added such as the ability to review the compiled JavaScript and the ability to view the compilation errors. Download the extension or check out the repo on Github.