CoffeeScript: The Cool Parts
Listen now
Description
CoffeeScript offers more than nice syntax for setting and managing data and functions. It also offers Classes, Inheritance, access to a 'super' method, Ruby-style string interpolation, easy variable and function bindings, and chained comparisons. Here's the code I showed in the video: class Vehicle constructor: (@name) -> move: (miles) -> console.log @name + " drove " + miles + " miles." class VWBug extends Vehicle move: -> console.log "Cruisin'..." super 100 class Truck extends Vehicle move: -> console.log "Haulin'..." super 50 mater = new Truck "Mater" herbie = new VWBug "Herbie" mater.move() herbie.move() a1c = "7.6" healthy = 7.0 > a1c > 5.0 console.log "A1C within healthy range: #{a1c}" Account = (customer, cart) -> @customer = customer @cart = cart $('.shopping_cart').click (event) => @customer.purchase @cart If you're new to CoffeeScript, make sure you check out the CoffeeScript Cookbook and CoffeeScript Basics. Download 150.3 MB Download (iPod & iPhone) 87.1 MB
More Episodes
My Equipment: Mackie PROFX12 12-Channel Compact Effects Mixer with USB Sony MDR7506 Professional Large Diaphragm Headphone Roland R-05 Studio WAVE/MP3 Recorder Transcend 32 GB Class 10 SDHC Flash Memory Card (TS32GSDHC10E) (for the Roland R-05) Griffin Technology iMic USB Audio...
Published 12/20/12
When preparing to add some layout features to JotRod, I realized it was a Rails 3.0.9 application. Here's a quick rundown on upgrading to Rails 3.1.3. Download 164.7 MB Download (iPod & iPhone) 37.9 MB Take the 2011 Readers Survey
Published 12/09/11