Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CoffeeScript - Spartan Javascript

CoffeeScript - Spartan Javascript

Going over the basics of CoffeeScript. Given at BarCampRochester and BuffaloJS.

Nick Quaranto

January 16, 2013
Tweet

More Decks by Nick Quaranto

Other Decks in Programming

Transcript

  1. the closest I’ve felt to the power I had 20

    years ago in Smalltalk ~Ward Cunningham
  2. function foo() func foo() function foo( function foo() func foo()

    function foo( function foo() func foo() function foo( function foo() func
  3. function foo() func foo() function foo( function foo() func foo()

    function foo( function foo() func foo() function foo( function foo() func
  4. var html = "<option value='" + this.id + "'>" +

    this.get("title") + "</option>";
  5. nums = [1, 2, 3] [ 1, 2, 3 ]

    sq = (n * n for n in nums) [ 1, 4, 9 ]
  6. nums = [1, 2, 3] [ 1, 2, 3 ]

    sq = (n * n for n in nums) [ 1, 4, 9 ]
  7. x = 6 6 x += 1 while x <

    10 [ 7, 8, 9, 10 ] x 10
  8. startWaiting: -> @waitTimeout ?= setTimeout => @$container.addClass "waiting" , 300

    stopWaiting: -> if @waitTimeout? clearTimeout @waitTimeout @waitTimeout = null @$container.removeClass "waiting"
  9. making coffee • Rails: http://guides.rubyonrails.org/ asset_pipeline.html • Jekyll & Rake:

    https://gist.github.com/4496420 • Node: npm install coffee • Anything else: Less.app http://incident57.com/less/