Coffeescript - take a sip of code
-
Upload
dimitris-tsironis -
Category
Technology
-
view
1.792 -
download
0
description
Transcript of Coffeescript - take a sip of code
![Page 1: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/1.jpg)
CoffeeScriptUnfancy JavaScript
![Page 2: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/2.jpg)
Dimitris Tsironis
CEO & Founder at Geembo
UI designer & huge geek, who loves good design and french fries, as much as good indentation in a stylesheet.
@tsironakos
![Page 3: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/3.jpg)
Jeremy AshkenasInteractive News at the NYTimes / DocumentCloud • Creator of CoffeeScript + Backbone.js • Code is Literature
![Page 4: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/4.jpg)
CoffeeScript is a little languagethat compiles into Javascript
![Page 5: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/5.jpg)
It’s just Javascript!
![Page 6: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/6.jpg)
Code is poetry...
![Page 7: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/7.jpg)
A beautiful programming language
Least amount of code to get the job done
Readable and understandable
Easy to maintain
well, should have elegant and beautiful form
![Page 8: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/8.jpg)
Let’s see some code!
![Page 9: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/9.jpg)
Variables
var message; message = “Ready for some coffee?”; alert(message);
CoffeeScript
JavaScript
coffee = -> confirm “Ready for some coffee?”
Functions
var coffee = function() { return confirm(“Ready for some coffee?”); }
CoffeeScript
JavaScript
message = “Ready for some coffee?” alert(message)
![Page 10: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/10.jpg)
Example
CoffeeScript
var coffee; coffee = function() { var answer; answer = confirm(“Ready for some coffee?”); return “Your answer is ” + answer; }
JavaScript
coffee = -> answer = confirm “Ready for some coffee?”
“Your answer is ” + answer
or “Your answer is #{answer}”
![Page 11: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/11.jpg)
Function Parameters
CoffeeScript
var coffee; coffee = function(message) { var answer; answer = confirm(message); return “Your answer is “ + answer; }
JavaScript
coffee = (message) -> answer = confirm message
“Your answer is #{answer}”
![Page 12: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/12.jpg)
Optional Parameters
CoffeeScript
var coffee; coffee = function(message) { var answer; if (message == null) { message = “Ready for some coffee?”; } answer = confirm(message); return “Your answer is “ + answer; }
JavaScript
coffee = (message = “Ready for some coffee”) -> answer = confirm message
“Your answer is #{answer}”
![Page 13: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/13.jpg)
Applied jQuery
CoffeeScript
jQuery(function($) { function changeTab(e) { e.preventDefault();\ $(“#tabs li a.active”).removeClass(“active”); $(this).addClass(“active”); } $(“#tabs ul li a”).click(changeTab);});
jQuery
$ -> changeTab = (e) -> e.preventDefault() $(“#tabs li a.active”).removeClass “active” $(@).addClass “active” $(“#tabs ul li a”).click changeTab
![Page 14: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/14.jpg)
You get the idea
![Page 15: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/15.jpg)
hubot, make me some coffee please!
![Page 16: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/16.jpg)
Hubot is your company's robot.Install him in your company to dramatically
improve and reduce employee efficiency.
![Page 17: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/17.jpg)
What he/she does
Lives in your chat (Campfire, GTalk, Hipchat etc.)
Deploys your code
Connect to your issues, commits etc.
Finds funny cat gifs
Integrates with almost every service on Earth
Manages the playlist in your office
everything you could imagine!
![Page 18: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/18.jpg)
Written in CoffeeScript(and some Perl and Shell)
![Page 19: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/19.jpg)
we have our own hubot
Meet Geembot!
![Page 20: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/20.jpg)
Open source & expandable(original written by Github Inc.)
![Page 21: Coffeescript - take a sip of code](https://reader034.fdocuments.us/reader034/viewer/2022042601/54742763b4af9fa30a8b5657/html5/thumbnails/21.jpg)
Thanks!
Follow me
@geembohq
@tsironakos