Slide 1

Slide 1 text

{ } } { { { } } } }{ { { }{ } } _____ __ __ ( }{ }{ { ) / ____| / _|/ _| .- { { } { }} -. | | ___ | |_| |_ ___ ___ ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ |`-..________ ..-'| | |___| (_) | | | || __/ __/ | | \_____\___/|_| |_| \___|\___| | ;--. | (__ \ _____ _ _ | | ) ) / ____| (_) | | | |/ / | (___ ___ _ __ _ _ __ | |_ | ( / \___ \ / __| '__| | '_ \| __| | |/ ____) | (__| | | | |_) | |_ | | |_____/ \___|_| |_| .__/ \__| `-.._________..-' | | |_| Wednesday, October 19, 11

Slide 2

Slide 2 text

Mark Wunsch @markwunsch { } } { { { } } } }{ { { }{ } } _____ __ __ ( }{ }{ { ) / ____| / _|/ _| .- { { } { }} -. | | ___ | |_| |_ ___ ___ ( ( } { } { } } ) | | / _ \| _| _/ _ \/ _ \ |`-..________ ..-'| | |___| (_) | | | || __/ __/ | | \_____\___/|_| |_| \___|\___| | ;--. | (__ \ _____ _ _ | | ) ) / ____| (_) | | | |/ / | (___ ___ _ __ _ _ __ | |_ | ( / \___ \ / __| '__| | '_ \| __| | |/ ____) | (__| | | | |_) | |_ | | |_____/ \___|_| |_| .__/ \__| `-.._________..-' | | |_| Exotic Programming Languages and the Web .oooooo. ooooo ooooo ooooooooooooo d8P' `Y8b `888' `888' 8' 888 `8 888 888 888 888 888 888 888 888 888 ooooo 888 888 888 `88. .88' 888 888 o 888 `Y8bood8P' o888o o888ooood8 o888o Wednesday, October 19, 11

Slide 3

Slide 3 text

var pg = require('pg'); //or native libpq bindings //var pg = require('pg').native var conString = "tcp://postgres:1234@localhost/postgres"; // error handling omitted pg.connect(conString, function(err, client) { client.query("SELECT NOW() as when", function(err, result) { console.log("Row count: %d",result.rows.length); // 1 console.log("Current year: %d", result.rows[0].when.getYear()); }); }); Wednesday, October 19, 11

Slide 4

Slide 4 text

Wednesday, October 19, 11

Slide 5

Slide 5 text

• compiles into JavaScript • JavaScript’s object model • “the good parts” • “It’s just JavaScript.” Wednesday, October 19, 11

Slide 6

Slide 6 text

skus = (sku for id, sku of order.skus) fling = (img) -> $('body').append img img.show() img.css '-webkit-transform': "rotate(#{rando()}deg)" 'top': root.parseInt(img.css('top'), 10) - rando 45 'left': root.parseInt(img.css('left'), 10) - rando 45 'opacity': 0 root.setTimeout (-> img.hide().remove()), 5000 rando = (multiplier = 10) -> num = Math.ceil Math.random() * multiplier if num % 2 then -num else num Wednesday, October 19, 11

Slide 7

Slide 7 text

skus = (sku for id, sku of order.skus) fling = (img) -> $('body').append img img.show() img.css '-webkit-transform': "rotate(#{rando()}deg)" 'top': root.parseInt(img.css('top'), 10) - rando 45 'left': root.parseInt(img.css('left'), 10) - rando 45 'opacity': 0 root.setTimeout (-> img.hide().remove()), 5000 rando = (multiplier = 10) -> num = Math.ceil Math.random() * multiplier if num % 2 then -num else num Wednesday, October 19, 11

Slide 8

Slide 8 text

skus = (sku for id, sku of order.skus) fling = (img) -> $('body').append img img.show() img.css '-webkit-transform': "rotate(#{rando()}deg)" 'top': root.parseInt(img.css('top'), 10) - rando 45 'left': root.parseInt(img.css('left'), 10) - rando 45 'opacity': 0 root.setTimeout (-> img.hide().remove()), 5000 rando = (multiplier = 10) -> num = Math.ceil Math.random() * multiplier if num % 2 then -num else num Wednesday, October 19, 11

Slide 9

Slide 9 text

skus = (sku for id, sku of order.skus) fling = (img) -> $('body').append img img.show() img.css '-webkit-transform': "rotate(#{rando()}deg)" 'top': root.parseInt(img.css('top'), 10) - rando 45 'left': root.parseInt(img.css('left'), 10) - rando 45 'opacity': 0 root.setTimeout (-> img.hide().remove()), 5000 rando = (multiplier = 10) -> num = Math.ceil Math.random() * multiplier if num % 2 then -num else num Wednesday, October 19, 11

Slide 10

Slide 10 text

name = person.name {name} = person {name, age} = person tag = "" [open, contents..., close] = tag.split("") if pin.properties.count isnt 1 for order, index in pin.properties.orders when (Date.now() - » Date.parse order?.submission_date) > (config.expiration ? 180000) class Mob constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." Wednesday, October 19, 11

Slide 11

Slide 11 text

name = person.name {name} = person {name, age} = person tag = "" [open, contents..., close] = tag.split("") if pin.properties.count isnt 1 for order, index in pin.properties.orders when (Date.now() - » Date.parse order?.submission_date) > (config.expiration ? 180000) class Mob constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." Wednesday, October 19, 11

Slide 12

Slide 12 text

name = person.name {name} = person {name, age} = person tag = "" [open, contents..., close] = tag.split("") if pin.properties.count isnt 1 for order, index in pin.properties.orders when (Date.now() - » Date.parse order?.submission_date) > (config.expiration ? 180000) class Mob constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." Wednesday, October 19, 11

Slide 13

Slide 13 text

name = person.name {name} = person {name, age} = person tag = "" [open, contents..., close] = tag.split("") if pin.properties.count isnt 1 for order, index in pin.properties.orders when (Date.now() - » Date.parse order?.submission_date) > (config.expiration ? 180000) class Mob constructor: (@name) -> move: (meters) -> alert @name + " moved #{meters}m." Wednesday, October 19, 11

Slide 14

Slide 14 text

Common concerns Wednesday, October 19, 11

Slide 15

Slide 15 text

Common concerns But what about my debugger? Wednesday, October 19, 11

Slide 16

Slide 16 text

Common concerns But what about my debugger? Compiled? Wednesday, October 19, 11

Slide 17

Slide 17 text

Thanks. Here are some links Mark Wunsch @markwunsch • http://coffeescript.org • https://github.com/jashkenas/coffee-script/wiki/List-of- languages-that-compile-to-JS • Line Number Mapping: https://github.com/jashkenas/coffee-script/ issues/558 • Hello World in Dart: https://gist.github.com/1277224 • Smooth CoffeeScript: http://autotelicum.github.com/Smooth- CoffeeScript/ • The Little Book on CoffeeScript: http://arcturo.github.com/ library/coffeescript/ Wednesday, October 19, 11