From e22b3e57a8c0b65dc8e43c3c185e3f7ca3a98b4a Mon Sep 17 00:00:00 2001 From: L8D Date: Wed, 31 Jul 2013 19:13:11 -0500 Subject: Started on the addition of coffeescript --- coffeescript.html.markdown | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 coffeescript.html.markdown (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown new file mode 100644 index 00000000..429f10b5 --- /dev/null +++ b/coffeescript.html.markdown @@ -0,0 +1,55 @@ +--- +language: coffeescript +contributors: + - ["Tenor Biel", "http://github.com/L8D"] +filename: coffeescript.coffee +--- + +``` coffeescript +# CoffeeScript is a hipster language. +# It goes with the trends of many modern languages. +# So comments are like Ruby and Python, they use hashes. + +### +Block comments are like these, and they translate directly to '/ *'s and '* /'s +for the resulting JavaScript code. + +You should understand most of JavaScript semantices +before continuing. +### + +# Assignment: +number = 42 #=> var number = 42; +opposite = true #=> var opposite = true; + +# Conditions: +number = -42 if opposite #=> if(opposite) { number = -42; } + +# Functions: +square = (x) -> x * x #=> var square = function(x) { return x * x; } + +# Ranges: +list = [1..5] #=> var list = [1, 2, 3, 4, 5]; + +# Objects: +math = + root: Math.sqrt + square: square + cube: (x) -> x * square x +#=> var math = { +# "root": Math.sqrt, +# "square": square, +# "cube": function(x) { return x * square(x); } +#} + +# Splats: +race = (winner, runners...) -> + print winner, runners + +# Existence: +alert "I knew it!" if elvis? +#=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } + +# Array comprehensions: +cubes = (math.cube num for num in list) #=> ... +``` -- cgit v1.2.3 From ce005d7fdb9a6a6815f88b08ab42ee6fbf689abb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rory=20O=E2=80=99Kane?= Date: Wed, 29 Jan 2014 21:34:56 -0500 Subject: Link to CoffeeScript official website --- coffeescript.html.markdown | 2 ++ 1 file changed, 2 insertions(+) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 429f10b5..c61cad67 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -5,6 +5,8 @@ contributors: filename: coffeescript.coffee --- +See also [the CoffeeScript website](http://coffeescript.org/), which has a complete tutorial on CoffeeScript. + ``` coffeescript # CoffeeScript is a hipster language. # It goes with the trends of many modern languages. -- cgit v1.2.3 From a089ef9b0d9a287e0b90f33f4c40b28b7f992783 Mon Sep 17 00:00:00 2001 From: Xavier Yao Date: Wed, 5 Feb 2014 21:37:17 +0800 Subject: Expend CoffeeScript doc --- coffeescript.html.markdown | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index c61cad67..86c875ba 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -2,9 +2,13 @@ language: coffeescript contributors: - ["Tenor Biel", "http://github.com/L8D"] + - ["Xavier Yao"], "http://github.com/xavieryao"] filename: coffeescript.coffee --- +CoffeeScript is a little language that compiles one-to-one into the equivalent JavaScript, and there is no interpretation at runtime. +As one of the succeeders of JavaScript, CoffeeScript tries its best to output readable, pretty-printed and smooth-running JavaScript codes working well in every JavaScript runtime. + See also [the CoffeeScript website](http://coffeescript.org/), which has a complete tutorial on CoffeeScript. ``` coffeescript @@ -30,6 +34,17 @@ number = -42 if opposite #=> if(opposite) { number = -42; } # Functions: square = (x) -> x * x #=> var square = function(x) { return x * x; } +fill = (container, liquid = "coffee") -> + "Filling the #{container} with #{liquid}..." +#=>var fill; +# +#fill = function(container, liquid) { +# if (liquid == null) { +# liquid = "coffee"; +# } +# return "Filling the " + container + " with " + liquid + "..."; +#}; + # Ranges: list = [1..5] #=> var list = [1, 2, 3, 4, 5]; @@ -47,11 +62,36 @@ math = # Splats: race = (winner, runners...) -> print winner, runners +#=>race = function() { +# var runners, winner; +# winner = arguments[0], runners = 2 <= arguments.length ? __slice.call(arguments, 1) : []; +# return print(winner, runners); +#}; # Existence: alert "I knew it!" if elvis? #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } # Array comprehensions: -cubes = (math.cube num for num in list) #=> ... +cubes = (math.cube num for num in list) +#=>cubes = (function() { +# var _i, _len, _results; +# _results = []; +# for (_i = 0, _len = list.length; _i < _len; _i++) { +# num = list[_i]; +# _results.push(math.cube(num)); +# } +# return _results; +# })(); + +foods = ['broccoli', 'spinach', 'chocolate'] +eat food for food in foods when food isnt 'chocolate' +#=>foods = ['broccoli', 'spinach', 'chocolate']; +# +#for (_k = 0, _len2 = foods.length; _k < _len2; _k++) { +# food = foods[_k]; +# if (food !== 'chocolate') { +# eat(food); +# } +#} ``` -- cgit v1.2.3 From ef16c2025e11b26f0589cd3719e55237abbb8a35 Mon Sep 17 00:00:00 2001 From: Adam Bard Date: Fri, 14 Mar 2014 18:18:23 +0000 Subject: Fix syntax errors in coffeescript headers --- coffeescript.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 86c875ba..82c6024c 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -2,7 +2,7 @@ language: coffeescript contributors: - ["Tenor Biel", "http://github.com/L8D"] - - ["Xavier Yao"], "http://github.com/xavieryao"] + - ["Xavier Yao", "http://github.com/xavieryao"] filename: coffeescript.coffee --- -- cgit v1.2.3 From 777c333ff078a7095f9b7ac303829b249f499b21 Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Mon, 14 Apr 2014 11:04:44 -0700 Subject: Remove references to hash and hashtag in favor of number symbol --- coffeescript.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 82c6024c..4fdf5903 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -14,7 +14,7 @@ See also [the CoffeeScript website](http://coffeescript.org/), which has a compl ``` coffeescript # CoffeeScript is a hipster language. # It goes with the trends of many modern languages. -# So comments are like Ruby and Python, they use hashes. +# So comments are like Ruby and Python, they use number symbols. ### Block comments are like these, and they translate directly to '/ *'s and '* /'s -- cgit v1.2.3 From 351263a6f47df080e6a0a8e351084e950c9c88c7 Mon Sep 17 00:00:00 2001 From: Gabriel Ruiz Date: Mon, 12 May 2014 12:47:35 -0700 Subject: added additional resources to coffeescript file --- coffeescript.html.markdown | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 4fdf5903..8fa2e81f 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -95,3 +95,9 @@ eat food for food in foods when food isnt 'chocolate' # } #} ``` + +## Additional resources + +- [The Little Book on CoffeeScript](http://arcturo.github.io/library/coffeescript/) +- [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) +- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto) -- cgit v1.2.3 From 14807c0eb73cd6bdd9ff291823d869fc337062e9 Mon Sep 17 00:00:00 2001 From: Gabriel Ruiz Date: Mon, 12 May 2014 14:12:39 -0700 Subject: removed little book on coffeescript --- coffeescript.html.markdown | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 8fa2e81f..d96eed39 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -98,6 +98,5 @@ eat food for food in foods when food isnt 'chocolate' ## Additional resources -- [The Little Book on CoffeeScript](http://arcturo.github.io/library/coffeescript/) - [Smooth CoffeeScript](http://autotelicum.github.io/Smooth-CoffeeScript/) -- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto) +- [CoffeeScript Ristretto](https://leanpub.com/coffeescript-ristretto/read) -- cgit v1.2.3 From eab554a7a7f2869ff7dac9f54acce9a7ed55cfa4 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 8 Sep 2014 13:08:28 +0200 Subject: Review docs for added rouge lexers and update those with new highlighters --- coffeescript.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index d96eed39..6af692b9 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -11,7 +11,7 @@ As one of the succeeders of JavaScript, CoffeeScript tries its best to output re See also [the CoffeeScript website](http://coffeescript.org/), which has a complete tutorial on CoffeeScript. -``` coffeescript +```coffeescript # CoffeeScript is a hipster language. # It goes with the trends of many modern languages. # So comments are like Ruby and Python, they use number symbols. -- cgit v1.2.3 From 93423c1b828062bc800d44d7cce8c3a20169294b Mon Sep 17 00:00:00 2001 From: Joel Gallant Date: Sun, 14 Sep 2014 13:18:43 -0600 Subject: Fixed very small spelling mistake semantices -> semantics --- coffeescript.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 6af692b9..4c080bc6 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -20,7 +20,7 @@ See also [the CoffeeScript website](http://coffeescript.org/), which has a compl Block comments are like these, and they translate directly to '/ *'s and '* /'s for the resulting JavaScript code. -You should understand most of JavaScript semantices +You should understand most of JavaScript semantics before continuing. ### -- cgit v1.2.3 From 960ee4a1856db8eadb96277bb2422edfa8f2a81c Mon Sep 17 00:00:00 2001 From: Gabriel Halley Date: Wed, 7 Oct 2015 23:11:24 -0400 Subject: removing whitespace all over --- coffeescript.html.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'coffeescript.html.markdown') diff --git a/coffeescript.html.markdown b/coffeescript.html.markdown index 4c080bc6..85a5f81f 100644 --- a/coffeescript.html.markdown +++ b/coffeescript.html.markdown @@ -6,7 +6,7 @@ contributors: filename: coffeescript.coffee --- -CoffeeScript is a little language that compiles one-to-one into the equivalent JavaScript, and there is no interpretation at runtime. +CoffeeScript is a little language that compiles one-to-one into the equivalent JavaScript, and there is no interpretation at runtime. As one of the succeeders of JavaScript, CoffeeScript tries its best to output readable, pretty-printed and smooth-running JavaScript codes working well in every JavaScript runtime. See also [the CoffeeScript website](http://coffeescript.org/), which has a complete tutorial on CoffeeScript. @@ -73,7 +73,7 @@ alert "I knew it!" if elvis? #=> if(typeof elvis !== "undefined" && elvis !== null) { alert("I knew it!"); } # Array comprehensions: -cubes = (math.cube num for num in list) +cubes = (math.cube num for num in list) #=>cubes = (function() { # var _i, _len, _results; # _results = []; -- cgit v1.2.3