Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CoffeeScript - Spartan Javascript
Search
Nick Quaranto
January 16, 2013
Programming
650
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CoffeeScript - Spartan Javascript
Going over the basics of CoffeeScript. Given at BarCampRochester and BuffaloJS.
Nick Quaranto
January 16, 2013
More Decks by Nick Quaranto
See All by Nick Quaranto
The GraphQL Way: A new path for JSON APIs
qrush
287
20k
Awesome Extractions Done Quick
qrush
1
590
rubygems.next
qrush
5
550
how to find GIFs
qrush
10
600
RubyMotion: The sleeper has awakened!
qrush
5
960
Basecamp Next: Code Spelunking
qrush
62
9.2k
m: a better Ruby Test::Unit runner
qrush
2
630
Test Driven Development
qrush
14
1.5k
Lapidary: The Art of Gemcutting
qrush
2
630
Other Decks in Programming
See All in Programming
パスワード再設定メールのURLについて知っておこう
uyuki234
0
160
phperだってパンチカードでコーディングしたい
o0h
PRO
0
350
なぜCTOを降りてFDEを選んだのか?〜なぜプロダクト企業がFDEで顧客の現場に踏み込むのか〜
gonta
1
220
3回つくってわかった、 定期実行ジョブ基盤の本質情報
takai
0
530
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
160
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.6k
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
170
R8 の設定見直しでアプリサイズ削減
andpad
0
220
sbt 2.0: takeoff
eed3si9n
0
160
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
760
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
2
810
npm との違いを手がかりにGo の依存管理を理解したい
optim
0
880
Featured
See All Featured
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
310
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
HDC tutorial
michielstock
2
960
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.2k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
360
Thoughts on Productivity
jonyablonski
76
5.4k
My Coaching Mixtape
mlcsv
0
360
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
How to make the Groovebox
asonas
2
2.5k
The SEO identity crisis: Don't let AI make you average
varn
0
590
Transcript
R R CoffeeScript @qrush BarCampRoc Apr 2013 Spartan JavaScript
None
JavaScript as a language is Not Verbose
Good JS is OO
Good JS is Concise
CoffeeScript is “Just JS”
CoffeeScript writes Good JS
CoffeeScript is Spartan!
a new battle! http://www.flickr.com/photos/pshab/1578426589/
the closest I’ve felt to the power I had 20
years ago in Smalltalk ~Ward Cunningham
it was the first time I experienced language envy ~DHH
I use both ~Brendan Eich
function foo() { }
function foo() func foo() function foo( function foo() func foo()
function foo( function foo() func foo() function foo( function foo() func
function foo() func foo() function foo( function foo() func foo()
function foo( function foo() func foo() function foo( function foo() func
this
this
foo = function() { return 1 + 1; }
foo = () -> 1 + 1
bar = function(x) { return x + 1; }
bar = (x) -> x + 1
_.bind(fn, obj) http://underscorejs.org/#bind http://coffeescript.org#fat_arrow
baz = () => this.foo()
foz = () => @foo()
$ -> new ItemsRouter() Backbone.history.start()
$ -> new ItemsRouter() Backbone.history.start()
more features
indents are scope
last statements implicitly return
all vars local by default
easier object syntax
title: "Sparta!" author: name: "Leonidas" handle: "theking" apples: 1
string interpolation
var html = "<option value='" + this.id + "'>" +
this.get("title") + "</option>";
"<option value='#{@id}'> #{@get("title")}</option>"
"<option value='#{@id}'> #{@get("title")}</option>"
inheritance actually works
class Item extends Backbone.Model url: -> "/events/#{@id}"
loops are less painful
None
nums = [4, 5, 6] for i in nums console.log
i 4 5 6
comprehensions compact code
nums = [1, 2, 3] [ 1, 2, 3 ]
sq = (n * n for n in nums) [ 1, 4, 9 ]
nums = [1, 2, 3] [ 1, 2, 3 ]
sq = (n * n for n in nums) [ 1, 4, 9 ]
conditionals and loops can be inline
console.log("Sparta!") if true Sparta! console.log("Persia!") unless false Sparta!
x = 6 6 x += 1 while x <
10 [ 7, 8, 9, 10 ] x 10
get existential
spear? false spear = -> "Throw!" [Function] spear? true
window.bcx ?= {} {}
startWaiting: -> @waitTimeout ?= setTimeout => @$container.addClass "waiting" , 300
stopWaiting: -> if @waitTimeout? clearTimeout @waitTimeout @waitTimeout = null @$container.removeClass "waiting"
meet your enemies
None
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/
debugging is not terrible
http://alexspeller.com/
some silly keywords
yes, true, on no, false, off
more info • http://coffeescript.org • http://coffeescript.codeschool.com/ • http://robots.thoughtbot.com/post/ 9251081564/coffeescript-spartan- javascript