From 06218c630f05f9944920ad12aaa2ec12dcb5d3b5 Mon Sep 17 00:00:00 2001 From: Charles Lecklider Date: Fri, 11 Apr 2014 11:04:34 +0100 Subject: [PATCH 01/33] ignore arrays with fewer than 2 elements --- chapters/arrays/shuffling-array-elements.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chapters/arrays/shuffling-array-elements.md b/chapters/arrays/shuffling-array-elements.md index 6e115da..12fbc16 100644 --- a/chapters/arrays/shuffling-array-elements.md +++ b/chapters/arrays/shuffling-array-elements.md @@ -80,9 +80,10 @@ you are able to run it on any array you wish, in a much more direct manner. {% highlight coffeescript %} do -> Array::shuffle ?= -> - for i in [@length-1..1] - j = Math.floor Math.random() * (i + 1) - [@[i], @[j]] = [@[j], @[i]] + if @length > 1 + for i in [@length-1..1] + j = Math.floor Math.random() * (i + 1) + [@[i], @[j]] = [@[j], @[i]] @ [1..9].shuffle() From b128dcc6760da0ea72bc68becd3c19530709796b Mon Sep 17 00:00:00 2001 From: Dave Powers Date: Mon, 3 Nov 2014 12:38:13 -0500 Subject: [PATCH 02/33] Correct "OSX" to "OS X" --- developers-guide.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/developers-guide.md b/developers-guide.md index 909847e..9e39f2f 100644 --- a/developers-guide.md +++ b/developers-guide.md @@ -9,7 +9,7 @@ _Please help out by updating this page_ ### Operating System -It works on Mac OSX. Probably works without any changes or issues on Linux. +It works on Mac OS X. Probably works without any changes or issues on Linux. A masochist could probably get it working on Windows. ## Installation From 77905d7e9fb09436a53c99b923b528c1e5b061a4 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Tue, 25 Nov 2014 14:42:49 -0800 Subject: [PATCH 03/33] Add option for con-splat-enating arrays CoffeeScript allows you to concatenate arrays by splatting them into an array literal. This change adds a section describing that option. --- chapters/arrays/concatenating-arrays.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/chapters/arrays/concatenating-arrays.md b/chapters/arrays/concatenating-arrays.md index df0be98..a023791 100644 --- a/chapters/arrays/concatenating-arrays.md +++ b/chapters/arrays/concatenating-arrays.md @@ -56,6 +56,16 @@ array1 # => [1, 2, 3, 4, 5, 6] {% endhighlight %} +A more idiomatic approach is to use the splat operator (`...`) directly in an array literal. This can be used to concatenate any number of arrays. + +{% highlight coffeescript %} +array1 = [1, 2, 3] +array2 = [4, 5, 6] +array3 = [array1..., array2...] +array3 +# => [1, 2, 3, 4, 5, 6] +{% endhighlight %} + ## Discussion CoffeeScript lacks a special syntax for joining arrays, but `concat()` and `push()` are standard JavaScript methods. From cf6af7220a9abc8a65da196b9f95d911d6221ddb Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Tue, 25 Nov 2014 14:45:03 -0800 Subject: [PATCH 04/33] Add myself to the authors list I hope that's not too presumptuous for such a small change. --- authors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/authors.md b/authors.md index 70bea43..fe612ef 100644 --- a/authors.md +++ b/authors.md @@ -23,6 +23,7 @@ The following people are totally rad and awesome because they have contributed r * [Anton Rissanen](http://github.com/antris) *hello@anton.fi* * Calum Robertson *http://github.com/randusr836* * Jake Burkhead *https://github.com/jlburkhead* +* [Alex Johnson](https://github.com/nonsensery) * ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking! # Developers From ba8b054d85bcaaeb31df8c1fc3c179e329cb94d8 Mon Sep 17 00:00:00 2001 From: neatcoding Date: Thu, 4 Dec 2014 15:25:57 +0100 Subject: [PATCH 05/33] additional idea of creating .repeat for String --- chapters/strings/repeating.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/chapters/strings/repeating.md b/chapters/strings/repeating.md index 2df0c3c..78214ab 100644 --- a/chapters/strings/repeating.md +++ b/chapters/strings/repeating.md @@ -18,6 +18,15 @@ Array(11).join 'foo' # => "foofoofoofoofoofoofoofoofoofoo" {% endhighlight %} +## Repeat method for Strings + +You could also create a method for this in String prototype. It is as simple as that: + +{% highlight coffeescript %} +# add repeat method for all strings, that returns string repeated n times +String::repeat = (n) -> Array(n+1).join(this) +{% endhighlight %} + ## Discussion JavaScript lacks a string repeat function, as does CoffeeScript. List comprehensions and maps can be pressed into service here, but in the case of a simple string repeat it's easier to simply build an array of n+1 nulls and then glue them together. From 16debf2cb469b32f5d6723d5cef69229cfe341fb Mon Sep 17 00:00:00 2001 From: Chris Coyne Date: Fri, 5 Dec 2014 11:29:50 -0500 Subject: [PATCH 06/33] fixed broken shuffle for arrays of length 1 or 0 Coffeescript's range evaluator (in this case [a.length-1..1]) produces inappropriate results for Fisher-Yates when the array is length 1 or 0. The unfixed shuffle pushes undefined values onto the the array. A length check is necessary to continue with this style. --- chapters/arrays/shuffling-array-elements.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/chapters/arrays/shuffling-array-elements.md b/chapters/arrays/shuffling-array-elements.md index 6e115da..b9054e6 100644 --- a/chapters/arrays/shuffling-array-elements.md +++ b/chapters/arrays/shuffling-array-elements.md @@ -18,12 +18,13 @@ the algorithm. {% highlight coffeescript %} shuffle = (a) -> - # From the end of the list to the beginning, pick element `i`. - for i in [a.length-1..1] - # Choose random element `j` to the front of `i` to swap with. - j = Math.floor Math.random() * (i + 1) - # Swap `j` with `i`, using destructured assignment - [a[i], a[j]] = [a[j], a[i]] + if a.length >= 2 + # From the end of the list to the beginning, pick element `i`. + for i in [a.length-1..1] + # Choose random element `j` to the front of `i` to swap with. + j = Math.floor Math.random() * (i + 1) + # Swap `j` with `i`, using destructured assignment + [a[i], a[j]] = [a[j], a[i]] # Return the shuffled array. a From fb597b29b7d2e505acc64c260a92ae59787400b8 Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Fri, 5 Dec 2014 13:26:55 -0500 Subject: [PATCH 07/33] Drop a level of indent and clean conditional --- chapters/arrays/shuffling-array-elements.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/chapters/arrays/shuffling-array-elements.md b/chapters/arrays/shuffling-array-elements.md index 12fbc16..edc2a33 100644 --- a/chapters/arrays/shuffling-array-elements.md +++ b/chapters/arrays/shuffling-array-elements.md @@ -79,12 +79,11 @@ The following code adds the shuffle function to the Array prototype, which means you are able to run it on any array you wish, in a much more direct manner. {% highlight coffeescript %} -do -> Array::shuffle ?= -> - if @length > 1 - for i in [@length-1..1] - j = Math.floor Math.random() * (i + 1) - [@[i], @[j]] = [@[j], @[i]] - @ +Array::shuffle ?= -> + if @length > 1 then for i in [@length-1..1] + j = Math.floor Math.random() * (i + 1) + [@[i], @[j]] = [@[j], @[i]] + this [1..9].shuffle() # => [ 3, 1, 5, 6, 4, 8, 2, 9, 7 ] From 319ca25965909e6d8b1e20bbafbe0adcf2dac450 Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Fri, 5 Dec 2014 13:29:39 -0500 Subject: [PATCH 08/33] Add Underscore.js footnote --- chapters/arrays/shuffling-array-elements.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chapters/arrays/shuffling-array-elements.md b/chapters/arrays/shuffling-array-elements.md index edc2a33..9686116 100644 --- a/chapters/arrays/shuffling-array-elements.md +++ b/chapters/arrays/shuffling-array-elements.md @@ -97,8 +97,10 @@ objects you don’t own][dontown]; [Extending built-in native objects. Evil or n operator (`?=`). That way, we don't overwrite someone else's, or a native browser method. Also, if you think you'll be using a lot of these utility functions, consider using a -utility library, like [Lo-dash](http://lodash.com/). They include a lot of nifty +utility library, like [Lo-dash](http://lodash.com/)^†. They include a lot of nifty features, like maps and forEach, in a cross-browser, lean, high-performance way. +^† [Underscore](http://underscorejs.org/) is also a good alternative to Lo-dash. + [dontown]: http://www.nczonline.net/blog/2010/03/02/maintainable-javascript-dont-modify-objects-you-down-own/ [extendevil]: http://perfectionkills.com/extending-built-in-native-objects-evil-or-not/ From 6988fe02bba770fb9af032e92b764369d6baa41c Mon Sep 17 00:00:00 2001 From: Devin Weaver Date: Fri, 5 Dec 2014 17:36:08 -0500 Subject: [PATCH 09/33] Clarify shuffle code Better variable names, Removed silly comments, Expanded explination of @malgorithms commit 16debf2 in comments --- chapters/arrays/shuffling-array-elements.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/chapters/arrays/shuffling-array-elements.md b/chapters/arrays/shuffling-array-elements.md index 2ecec79..c5f4193 100644 --- a/chapters/arrays/shuffling-array-elements.md +++ b/chapters/arrays/shuffling-array-elements.md @@ -17,16 +17,16 @@ at the end of the list. This [Fisher-Yates shuffle Visualization] may help you u the algorithm. {% highlight coffeescript %} -shuffle = (a) -> - if a.length >= 2 - # From the end of the list to the beginning, pick element `i`. - for i in [a.length-1..1] - # Choose random element `j` to the front of `i` to swap with. - j = Math.floor Math.random() * (i + 1) - # Swap `j` with `i`, using destructured assignment - [a[i], a[j]] = [a[j], a[i]] - # Return the shuffled array. - a +shuffle = (source) -> + # Arrays with < 2 elements do not shuffle well. Instead make it a noop. + return source unless source.length >= 2 + # From the end of the list to the beginning, pick element `index`. + for index in [source.length-1..1] + # Choose random element `randomIndex` to the front of `index` to swap with. + randomIndex = Math.floor Math.random() * (index + 1) + # Swap `randomIndex` with `index`, using destructured assignment + [source[index], source[randomIndex]] = [source[randomIndex], source[index]] + source shuffle([1..9]) # => [ 3, 1, 5, 6, 4, 8, 2, 9, 7 ] From 1e21f6c7172841fa1d3dd858b17d70b8580dc7e1 Mon Sep 17 00:00:00 2001 From: "lolmaus (Andrey Mikhaylov)" Date: Fri, 9 Jan 2015 19:26:04 +0300 Subject: [PATCH 10/33] Removed CNAME --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 75d2340..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -coffeescriptcookbook.com From 93554ef04e0f8d1111476fccc28183d5c0700648 Mon Sep 17 00:00:00 2001 From: "lolmaus (Andrey Mikhaylov)" Date: Fri, 9 Jan 2015 19:26:48 +0300 Subject: [PATCH 11/33] Added IntelliJ IDEA / Webstorm files to .gitignore --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 587c487..3ae9f09 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,7 @@ _site *.swo .DS_Store + +# IntelliJ IDEA / WebStorm +/.idea/ +/*.iml \ No newline at end of file From ebfed068b38686f06b43b78a07f9f57666a7e596 Mon Sep 17 00:00:00 2001 From: "lolmaus (Andrey Mikhaylov)" Date: Fri, 9 Jan 2015 19:32:01 +0300 Subject: [PATCH 12/33] Added {{ site.baseurl }} to all links --- _config.yml | 1 + _layouts/chapter.html | 24 +++++++++---------- _layouts/default.html | 24 +++++++++---------- _layouts/recipe.html | 24 +++++++++---------- authors-guide.md | 8 +++---- authors.md | 6 ++--- chapters/ajax/index.html | 2 +- chapters/arrays/index.html | 2 +- chapters/arrays/list-comprehensions.md | 4 ++-- chapters/arrays/mapping-arrays.md | 4 ++-- chapters/classes_and_objects/index.html | 2 +- chapters/databases/index.html | 2 +- chapters/dates_and_times/index.html | 2 +- chapters/design_patterns/adapter.md | 2 +- chapters/design_patterns/index.html | 2 +- chapters/functions/index.html | 2 +- chapters/index.html | 4 ++-- chapters/jquery/ajax.md | 2 +- chapters/jquery/index.html | 2 +- chapters/math/constants.md | 2 +- chapters/math/generating-random-numbers.md | 2 +- chapters/math/index.html | 2 +- .../working-with-exponents-and-logarithms.md | 2 +- chapters/metaprogramming/index.html | 2 +- chapters/networking/basic-client.md | 4 ++-- chapters/networking/basic-server.md | 4 ++-- chapters/networking/bi-directional-client.md | 4 ++-- chapters/networking/bi-directional-server.md | 4 ++-- chapters/networking/index.html | 2 +- chapters/regular_expressions/index.html | 2 +- chapters/strings/capitalizing-words.md | 2 +- chapters/strings/index.html | 2 +- chapters/syntax/index.html | 2 +- chapters/testing/index.html | 2 +- contributing.md | 8 +++---- designers-guide.md | 2 +- index.html | 2 +- license.md | 2 +- 38 files changed, 86 insertions(+), 85 deletions(-) diff --git a/_config.yml b/_config.yml index fef8911..6214b0c 100644 --- a/_config.yml +++ b/_config.yml @@ -1,3 +1,4 @@ +baseurl: '' safe: true pygments: true lsi: false diff --git a/_layouts/chapter.html b/_layouts/chapter.html index 2bfe664..3023ec9 100644 --- a/_layouts/chapter.html +++ b/_layouts/chapter.html @@ -23,15 +23,15 @@ CoffeeScript Cookbook » {{ page.title }} - - + +
-

óCoffeeScript Cookbook

+

óCoffeeScript Cookbook

@@ -42,8 +42,8 @@

{{ page.title }}

@@ -54,7 +54,7 @@

{{ page.title }}

@@ -62,9 +62,9 @@
óCoffeeScrip @@ -76,12 +76,12 @@
{% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %} {% capture indexurl %}{{ url }}/index.html{% endcapture %}
  • - +
      {% for site_page in site.pages %} {% if site_page.url contains url %} {% unless site_page.url == indexurl %} -
    • {{ site_page.title }}
    • +
    • {{ site_page.title }}
    • {% endunless %} {% endif %} {% endfor %} @@ -93,7 +93,7 @@ - + diff --git a/_layouts/default.html b/_layouts/default.html index b45615d..9d8fe47 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -23,15 +23,15 @@ CoffeeScript Cookbook » {{ page.title }} - - + +
      -

      óCoffeeScript Cookbook

      +

      óCoffeeScript Cookbook

      @@ -39,8 +39,8 @@

      ó{{ content }}

      @@ -51,7 +51,7 @@

      ó

      @@ -59,9 +59,9 @@
      óCoffeeScrip @@ -73,12 +73,12 @@
      {% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %} {% capture indexurl %}{{ url }}/index.html{% endcapture %}
    • - +
        {% for site_page in site.pages %} {% if site_page.url contains url %} {% unless site_page.url == indexurl %} -
      • {{ site_page.title }}
      • +
      • {{ site_page.title }}
      • {% endunless %} {% endif %} {% endfor %} @@ -90,7 +90,7 @@ - + diff --git a/_layouts/recipe.html b/_layouts/recipe.html index fd6e969..215830d 100644 --- a/_layouts/recipe.html +++ b/_layouts/recipe.html @@ -23,15 +23,15 @@ CoffeeScript Cookbook » {{ page.title }} - - + +
        -

        óCoffeeScript Cookbook

        +

        óCoffeeScript Cookbook

        @@ -42,8 +42,8 @@

        {{ page.title }}

        -

        Is this recipe wrong, incomplete, or non idiomatic? Help fix it by reading the Contributor's Guide!

        - +

        Is this recipe wrong, incomplete, or non idiomatic? Help fix it by reading the Contributor's Guide!

        +
        @@ -53,7 +53,7 @@

        {{ page.title }}

        @@ -61,9 +61,9 @@
        óCoffeeScrip @@ -75,12 +75,12 @@
        {% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %} {% capture indexurl %}{{ url }}/index.html{% endcapture %}
      • - +
          {% for site_page in site.pages %} {% if site_page.url contains url %} {% unless site_page.url == indexurl %} -
        • {{ site_page.title }}
        • +
        • {{ site_page.title }}
        • {% endunless %} {% endif %} {% endfor %} @@ -92,7 +92,7 @@ - + diff --git a/authors-guide.md b/authors-guide.md index 54c1b26..2504368 100644 --- a/authors-guide.md +++ b/authors-guide.md @@ -6,7 +6,7 @@ title: Author's Guide ## tl;dr: Look at Other Recipes, and Blend In -Look at the source of other recipe pages and follow that page structure. Start with the [Developer's Guide](/developers-guide) to get a test version of the cookbook up and running on your machine, and get to work! +Look at the source of other recipe pages and follow that page structure. Start with the [Developer's Guide]({{ site.baseurl }}/developers-guide) to get a test version of the cookbook up and running on your machine, and get to work! ## General Guidelines @@ -26,7 +26,7 @@ A typical cookbook page will have three sections (four if you count the title): ## Copyright Issues -Do not post code that is copyrighted by another user, unless you have permission to use that code AND to relicense that code under the [CC BY 3.0](/license) license. If you DO have permission and the author would like credit, please add them to the [authors](/authors) page. +Do not post code that is copyrighted by another user, unless you have permission to use that code AND to relicense that code under the [CC BY 3.0]({{ site.baseurl }}/license) license. If you DO have permission and the author would like credit, please add them to the [authors]({{ site.baseurl }}/authors) page. Also, just a stylistic note, please do not yank code directly from [http://coffeescript.org/](http://coffeescript.org/) and post it with little or no discussion. The CoffeeScript Cookbook is not affiliated with them. We think they're awesome and want them to like us, too! Make sure that anything taken from [http://coffeescript.org/](http://coffeescript.org/) is permissible use and that it stands alone as a valid recipe. If the recipe is too terse, consider adding more examples and discussion. @@ -99,7 +99,7 @@ When in doubt about what output to show, try evaluating your snippet in the coff ## How to Add a Recipe -Create a new markdown page (or copy the [Recipe Template](/recipe-template). The filename should be about the problem, e.g. `finding-last-day-of-the-month.md` or `reversing-arrays.md`. In your file, start with the following template: +Create a new markdown page (or copy the [Recipe Template]({{ site.baseurl }}/recipe-template). The filename should be about the problem, e.g. `finding-last-day-of-the-month.md` or `reversing-arrays.md`. In your file, start with the following template: {% highlight text %} --- @@ -175,7 +175,7 @@ See the "Weird Recipe" note above. Do real people in the real world ever hit the ## I Have A Problem/Solution, But It's Basically Just JavaScript. Should I Add It? -Yes! CoffeeScript compiles to JavaScript, and that means that some of its functionality comes straight from JavaScript. (For example, see [Reversing Arrays](/chapters/arrays/reversing-arrays).) But if you're programming in CoffeeScript and you need to reverse an array, this Cookbook should stand ready to tell you it's available to you in CoffeeScript -- even if it's just a straight call into a JavaScript library. +Yes! CoffeeScript compiles to JavaScript, and that means that some of its functionality comes straight from JavaScript. (For example, see [Reversing Arrays]({{ site.baseurl }}/chapters/arrays/reversing-arrays).) But if you're programming in CoffeeScript and you need to reverse an array, this Cookbook should stand ready to tell you it's available to you in CoffeeScript -- even if it's just a straight call into a JavaScript library. ## I Found a Typo. Is That Enough of a Fix? Does That Count? diff --git a/authors.md b/authors.md index fe612ef..3b3b236 100644 --- a/authors.md +++ b/authors.md @@ -24,7 +24,7 @@ The following people are totally rad and awesome because they have contributed r * Calum Robertson *http://github.com/randusr836* * Jake Burkhead *https://github.com/jlburkhead* * [Alex Johnson](https://github.com/nonsensery) -* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking! +* ...You! What are you waiting for? Check out the [contributing]({{ site.baseurl }}/contributing) section and get cracking! # Developers @@ -34,11 +34,11 @@ The following people are totally rad and awesome because they have contributed r * Mike Moore *mike@blowmage.com* * Peter Hellberg *peter@c7.se* * Jamie Gaskins *jgaskins@gmail.com* -* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking! +* ...You! What are you waiting for? Check out the [contributing]({{ site.baseurl }}/contributing) section and get cracking! # Designers The following people are astonishingly rad and awesome because they did great design for the site! * [Amsul](http://github.com/amsul) reach@amsul.ca -* ...You! Check out the [contributing](/contributing) section and get cracking! +* ...You! Check out the [contributing]({{ site.baseurl }}/contributing) section and get cracking! diff --git a/chapters/ajax/index.html b/chapters/ajax/index.html index 5ca402b..0dfcd24 100644 --- a/chapters/ajax/index.html +++ b/chapters/ajax/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/arrays/index.html b/chapters/arrays/index.html index 80b9b41..906700a 100644 --- a/chapters/arrays/index.html +++ b/chapters/arrays/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/arrays/list-comprehensions.md b/chapters/arrays/list-comprehensions.md index 68e7c88..3ab2700 100644 --- a/chapters/arrays/list-comprehensions.md +++ b/chapters/arrays/list-comprehensions.md @@ -9,7 +9,7 @@ You have an array of objects and want to map them to another array, similar to P ## Solution -Use a list comprehension, but don't forget about [mapping arrays](/chapters/arrays/mapping-arrays). +Use a list comprehension, but don't forget about [mapping arrays]({{ site.baseurl }}/chapters/arrays/mapping-arrays). {% highlight coffeescript %} electric_mayhem = [ { name: "Doctor Teeth", instrument: "piano" }, @@ -25,4 +25,4 @@ names = (muppet.name for muppet in electric_mayhem) ## Discussion -Because CoffeeScript directly support list comprehensions, they work pretty much as advertised wherever you would use one in Python. For simple mappings, list comprehensions are much more readable. For complicated transformations or for chained mappings, [mapping arrays](/chapters/arrays/mapping-arrays) might be more elegant. +Because CoffeeScript directly support list comprehensions, they work pretty much as advertised wherever you would use one in Python. For simple mappings, list comprehensions are much more readable. For complicated transformations or for chained mappings, [mapping arrays]({{ site.baseurl }}/chapters/arrays/mapping-arrays) might be more elegant. diff --git a/chapters/arrays/mapping-arrays.md b/chapters/arrays/mapping-arrays.md index 6a54964..1be0e65 100644 --- a/chapters/arrays/mapping-arrays.md +++ b/chapters/arrays/mapping-arrays.md @@ -9,7 +9,7 @@ You have an array of objects and want to map them to another array, similar to R ## Solution -Use map() with an anonymous function, but don't forget about list comprehensions. +Use map() with an anonymous function, but don't forget about list comprehensions. {% highlight coffeescript %} electric_mayhem = [ { name: "Doctor Teeth", instrument: "piano" }, @@ -27,4 +27,4 @@ names = electric_mayhem.map (muppet) -> muppet.name Because CoffeeScript has clean support for anonymous functions, mapping an array in CoffeeScript is nearly as easy as it is in Ruby. -Maps are are good way to handle complicated transforms and chained mappings in CoffeeScript. If your transformation is as simple as the one above, however, it may read more cleanly as a list comprehension. +Maps are are good way to handle complicated transforms and chained mappings in CoffeeScript. If your transformation is as simple as the one above, however, it may read more cleanly as a list comprehension. diff --git a/chapters/classes_and_objects/index.html b/chapters/classes_and_objects/index.html index 082c0a3..013fd47 100644 --- a/chapters/classes_and_objects/index.html +++ b/chapters/classes_and_objects/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/databases/index.html b/chapters/databases/index.html index 6100569..abf1318 100644 --- a/chapters/databases/index.html +++ b/chapters/databases/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/dates_and_times/index.html b/chapters/dates_and_times/index.html index 969aee4..3009762 100644 --- a/chapters/dates_and_times/index.html +++ b/chapters/dates_and_times/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/design_patterns/adapter.md b/chapters/design_patterns/adapter.md index bcf4544..e82d19b 100644 --- a/chapters/design_patterns/adapter.md +++ b/chapters/design_patterns/adapter.md @@ -10,7 +10,7 @@ Luckily, you remembered you've brought your power adapter with you. It will connect your power cord socket on one side and wall socket on the other side, allowing for communication between them. The same situation may arise in code, when 2 (or more) instances (of classes, modules, etc.) want to talk to each other, but whose communication protocol (e.i. the language they use to communicate) is different from each other. -In such a situation, the [Adapter Pattern](//en.wikipedia.org/wiki/Adapter_pattern) comes in handy. It will do the translation, from one side to the other. +In such a situation, the [Adapter Pattern]({{ site.baseurl }}//en.wikipedia.org/wiki/Adapter_pattern) comes in handy. It will do the translation, from one side to the other. ## Solution diff --git a/chapters/design_patterns/index.html b/chapters/design_patterns/index.html index e488a5d..a548aad 100644 --- a/chapters/design_patterns/index.html +++ b/chapters/design_patterns/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/functions/index.html b/chapters/functions/index.html index be9a60a..eb3b4e9 100644 --- a/chapters/functions/index.html +++ b/chapters/functions/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
        • {{ page.title }}
        • +
        • {{ page.title }}
        • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/index.html b/chapters/index.html index 9e2f0e9..28abe74 100644 --- a/chapters/index.html +++ b/chapters/index.html @@ -28,12 +28,12 @@ {% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %} {% capture indexurl %}{{ url }}/index.html{% endcapture %}
        • -

          {{ chapter }}

          +

          {{ chapter }}

            {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/jquery/ajax.md b/chapters/jquery/ajax.md index 97d0769..54d89a5 100644 --- a/chapters/jquery/ajax.md +++ b/chapters/jquery/ajax.md @@ -43,4 +43,4 @@ jQuery 1.5 and later have added a new, supplemental API for handling different c ## Discussion -The jQuery and $ variables can be used interchangeably. See also [Callback bindings](/chapters/jquery/callback-bindings-jquery). +The jQuery and $ variables can be used interchangeably. See also [Callback bindings]({{ site.baseurl }}/chapters/jquery/callback-bindings-jquery). diff --git a/chapters/jquery/index.html b/chapters/jquery/index.html index 278cdbe..770dd77 100644 --- a/chapters/jquery/index.html +++ b/chapters/jquery/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/math/constants.md b/chapters/math/constants.md index 989012a..d3d25c7 100644 --- a/chapters/math/constants.md +++ b/chapters/math/constants.md @@ -45,4 +45,4 @@ Math.LOG10E ## Discussion -For another example of how a math constant is used in a real world problem, refer to the [Converting Radians and Degrees](/chapters/math/radians-degrees) section of this Math chapter. +For another example of how a math constant is used in a real world problem, refer to the [Converting Radians and Degrees]({{ site.baseurl }}/chapters/math/radians-degrees) section of this Math chapter. diff --git a/chapters/math/generating-random-numbers.md b/chapters/math/generating-random-numbers.md index e795652..e1b3a44 100644 --- a/chapters/math/generating-random-numbers.md +++ b/chapters/math/generating-random-numbers.md @@ -36,6 +36,6 @@ range = Math.random() * (max - min) + min This is a straight lift from JavaScript. -Note that JavaScript's Math.random() does not allow you to seed the random number generator to force certain values. See [Generating Predictable Random Numbers](/chapters/math/generating-predictable-random-numbers) for that. +Note that JavaScript's Math.random() does not allow you to seed the random number generator to force certain values. See [Generating Predictable Random Numbers]({{ site.baseurl }}/chapters/math/generating-predictable-random-numbers) for that. To generate a number from 0 up to (but not including) n, multiply by n. To generate a number from 1 to n (inclusive), multiply by n and add 1. diff --git a/chapters/math/index.html b/chapters/math/index.html index 5ad24b7..32eafac 100644 --- a/chapters/math/index.html +++ b/chapters/math/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/math/working-with-exponents-and-logarithms.md b/chapters/math/working-with-exponents-and-logarithms.md index c8e7c49..13aedaf 100644 --- a/chapters/math/working-with-exponents-and-logarithms.md +++ b/chapters/math/working-with-exponents-and-logarithms.md @@ -34,4 +34,4 @@ Math.log(100) / Math.log(10) ## Discussion -For more information on the Math object see the documentation on the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math). Also refer to [Math Constants](/chapters/math/constants) for discussion of the various constants in the Math object. +For more information on the Math object see the documentation on the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math). Also refer to [Math Constants]({{ site.baseurl }}/chapters/math/constants) for discussion of the various constants in the Math object. diff --git a/chapters/metaprogramming/index.html b/chapters/metaprogramming/index.html index 7287ee9..4a53a21 100644 --- a/chapters/metaprogramming/index.html +++ b/chapters/metaprogramming/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/networking/basic-client.md b/chapters/networking/basic-client.md index 64b3452..e9556db 100644 --- a/chapters/networking/basic-client.md +++ b/chapters/networking/basic-client.md @@ -31,7 +31,7 @@ connection.on 'data', (data) -> ### Example Usage -Accessing the [Basic Server](/chapters/networking/basic-server): +Accessing the [Basic Server]({{ site.baseurl }}/chapters/networking/basic-server): {% highlight console %} $ coffee basic-client.coffee @@ -43,7 +43,7 @@ Received: Hello, World! The most important work takes place in the _connection.on 'data'_ handler, where the client receives its response from the server and would most likely arrange for responses to it. -See also the [Basic Server](/chapters/networking/basic-server), [Bi-Directional Client](/chapters/networking/bi-directional-client), and [Bi-Directional Server](/chapters/networking/bi-directional-server) recipes. +See also the [Basic Server]({{ site.baseurl }}/chapters/networking/basic-server), [Bi-Directional Client]({{ site.baseurl }}/chapters/networking/bi-directional-client), and [Bi-Directional Server]({{ site.baseurl }}/chapters/networking/bi-directional-server) recipes. ### Exercises diff --git a/chapters/networking/basic-server.md b/chapters/networking/basic-server.md index 9dd55c9..90bb381 100644 --- a/chapters/networking/basic-server.md +++ b/chapters/networking/basic-server.md @@ -30,7 +30,7 @@ server.listen port, domain ### Example Usage -Accessed by the [Basic Client](/chapters/networking/basic-client): +Accessed by the [Basic Client]({{ site.baseurl }}/chapters/networking/basic-client): {% highlight console %} $ coffee basic-server.coffee @@ -44,7 +44,7 @@ Received connection from 127.0.0.1 The function passed to @net.createServer@ receives the new socket provided for each new connection to a client. This basic server simply socializes with its visitors but a hard-working server would pass this socket along to a dedicated handler and then return to the task of waiting for the next client. -See also the [Basic Client](/chapters/networking/basic-client), [Bi-Directional Server](/chapters/networking/bi-directional-server), and [Bi-Directional Client](/chapters/networking/bi-directional-client) recipes. +See also the [Basic Client]({{ site.baseurl }}/chapters/networking/basic-client), [Bi-Directional Server]({{ site.baseurl }}/chapters/networking/bi-directional-server), and [Bi-Directional Client]({{ site.baseurl }}/chapters/networking/bi-directional-client) recipes. ### Exercises diff --git a/chapters/networking/bi-directional-client.md b/chapters/networking/bi-directional-client.md index b7e020e..99953d7 100644 --- a/chapters/networking/bi-directional-client.md +++ b/chapters/networking/bi-directional-client.md @@ -41,7 +41,7 @@ connection.on 'end', (data) -> ### Example Usage -Accessing the [Bi-Directional Server](/chapters/networking/bi-directional-server): +Accessing the [Bi-Directional Server]({{ site.baseurl }}/chapters/networking/bi-directional-server): {% highlight console %} $ coffee bi-directional-client.coffee @@ -60,7 +60,7 @@ Connection closed This particular example initiates contact with the server and starts the conversation in the @connection.on 'connect'@ handler. The bulk of the work in a real client, however, will lie in the @connection.on 'data'@ handler, which processes output from the server. The @ping@ function only recurses in order to illustrate continuous communication with the server and can be removed from a real client. -See also the [Bi-Directional Server](/chapters/networking/bi-directional-server), [Basic Client](/chapters/networking/basic-client), and [Basic Server](/chapters/networking/basic-server) recipes. +See also the [Bi-Directional Server]({{ site.baseurl }}/chapters/networking/bi-directional-server), [Basic Client]({{ site.baseurl }}/chapters/networking/basic-client), and [Basic Server]({{ site.baseurl }}/chapters/networking/basic-server) recipes. ### Exercises diff --git a/chapters/networking/bi-directional-server.md b/chapters/networking/bi-directional-server.md index d187f92..cb1b982 100644 --- a/chapters/networking/bi-directional-server.md +++ b/chapters/networking/bi-directional-server.md @@ -33,7 +33,7 @@ server.listen port, domain ### Example Usage -Accessed by the [Bi-Directional Client](/chapters/networking/bi-directional-client): +Accessed by the [Bi-Directional Client]({{ site.baseurl }}/chapters/networking/bi-directional-client): {% highlight console %} $ coffee bi-directional-server.coffee @@ -49,7 +49,7 @@ New connection from 127.0.0.1 The bulk of the work lies in the @socket.on 'data'@ handler, which processes all of the input from the client. A real server would likely pass the data onto another function to process it and generate any responses so that the original handler. -See also the [Bi-Directional Client](/chapters/networking/bi-directional-client), [Basic Client](/chapters/networking/basic-client), and [Basic Server](/chapters/networking/basic-server) recipes. +See also the [Bi-Directional Client]({{ site.baseurl }}/chapters/networking/bi-directional-client), [Basic Client]({{ site.baseurl }}/chapters/networking/basic-client), and [Basic Server]({{ site.baseurl }}/chapters/networking/basic-server) recipes. ### Exercises diff --git a/chapters/networking/index.html b/chapters/networking/index.html index 5cc875e..27de60d 100644 --- a/chapters/networking/index.html +++ b/chapters/networking/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/regular_expressions/index.html b/chapters/regular_expressions/index.html index bc841bc..4af6fec 100644 --- a/chapters/regular_expressions/index.html +++ b/chapters/regular_expressions/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/strings/capitalizing-words.md b/chapters/strings/capitalizing-words.md index 17854d6..28ac74d 100644 --- a/chapters/strings/capitalizing-words.md +++ b/chapters/strings/capitalizing-words.md @@ -25,7 +25,7 @@ Or do the same thing using a list comprehension: ## Discussion -Split, map, join is a common scripting pattern dating back to Perl. This function may benefit from being placed directly onto the String class by [Extending Classes](/chapters/objects/extending-classes). +Split, map, join is a common scripting pattern dating back to Perl. This function may benefit from being placed directly onto the String class by [Extending Classes]({{ site.baseurl }}/chapters/objects/extending-classes). Be aware that two wrinkles can appear in the split, map, join pattern. The first is that the split text works best when it is constant. If the source string has multiple spaces in it, the split will need to take this into account to prevent getting extra, empty words. One way to do this is with a regular expression to split on runs of whitespace instead of a single space: diff --git a/chapters/strings/index.html b/chapters/strings/index.html index 50a3d9f..b74efe3 100644 --- a/chapters/strings/index.html +++ b/chapters/strings/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/syntax/index.html b/chapters/syntax/index.html index deb6165..03ab758 100644 --- a/chapters/syntax/index.html +++ b/chapters/syntax/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/chapters/testing/index.html b/chapters/testing/index.html index a838b6f..228a39f 100644 --- a/chapters/testing/index.html +++ b/chapters/testing/index.html @@ -11,7 +11,7 @@ {% for page in site.pages %} {% if page.url contains url %} {% unless page.url == indexurl %} -
          • {{ page.title }}
          • +
          • {{ page.title }}
          • {% endunless %} {% endif %} {% endfor %} diff --git a/contributing.md b/contributing.md index e51cdee..f1f14a7 100644 --- a/contributing.md +++ b/contributing.md @@ -15,16 +15,16 @@ Here's the Contribution Recipe: ## Wanted Recipes -Want to help, but don't know where to start? Want a recipe, but don't know how to write it? Check out the [Wanted Recipes](/wanted-recipes) page! +Want to help, but don't know where to start? Want a recipe, but don't know how to write it? Check out the [Wanted Recipes]({{ site.baseurl }}/wanted-recipes) page! ## Authors -Write recipes! Fork the repository, author some pages, and send us a pull request. For more information read the [Author's Guide](/authors-guide). +Write recipes! Fork the repository, author some pages, and send us a pull request. For more information read the [Author's Guide]({{ site.baseurl }}/authors-guide). ## Developers -Improve the code! Fork the repository, extend or improve the site coded, and send a pull request. For more information read the [Developer's Guide](/developers-guide). +Improve the code! Fork the repository, extend or improve the site coded, and send a pull request. For more information read the [Developer's Guide]({{ site.baseurl }}/developers-guide). ## Designers -Make this site look pretty! Fork the repository, extend, improve or update the design, and send a pull request. For more information read the [Designer's Guide](/designers-guide). +Make this site look pretty! Fork the repository, extend, improve or update the design, and send a pull request. For more information read the [Designer's Guide]({{ site.baseurl }}/designers-guide). diff --git a/designers-guide.md b/designers-guide.md index 3a510a0..df6381c 100644 --- a/designers-guide.md +++ b/designers-guide.md @@ -5,7 +5,7 @@ title: Designer's Guide # Designer's Guide -Start with the [Developer's Guide](/developers-guide) to get a test version of the cookbook up and running on your machine, and get started! +Start with the [Developer's Guide]({{ site.baseurl }}/developers-guide) to get a test version of the cookbook up and running on your machine, and get started! If you have been waiting for your chance to literally _write the designer's guide_ for a website that is also a cookbook about CoffeeScript... diff --git a/index.html b/index.html index 98947f9..cd3f572 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@

            Welcome to the CoffeeScript Cookbook!

            -

            CoffeeScript recipes for the community by the community. Head over to the Contribute page and see what you can do to help out!

            +

            CoffeeScript recipes for the community by the community. Head over to the Contribute page and see what you can do to help out!

            diff --git a/license.md b/license.md index f4a9905..ae1a2ee 100644 --- a/license.md +++ b/license.md @@ -5,4 +5,4 @@ title: License coffeescriptcookbook.com is licensed under the [Creative Commons Attribution 3.0 Unported (CC BY 3.0)](http://creativecommons.org/licenses/by/3.0/) license. By submitting information to this site you agree to grant this license to all users of the site, and that your editing of the authors page constitutes satisfactory attribution. -[LICENSE](/LICENSE-CC-BY) +[LICENSE]({{ site.baseurl }}/LICENSE-CC-BY) From cedf5fa4dbce6b8ff8046b7f7715dfcc5c27aa86 Mon Sep 17 00:00:00 2001 From: "lolmaus (Andrey Mikhaylov)" Date: Fri, 9 Jan 2015 19:38:26 +0300 Subject: [PATCH 13/33] Updated the hostname in links coffeescriptcookbook.com -> coffeescript-cookbook.github.io --- README.md | 14 +++++++------- license.md | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7378cd1..ce574db 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ We want you to write recipes and make the site better! Contributing ----------- -You can find details about contributing [on the site](http://coffeescriptcookbook.com/contributing). For now here is a simple formula: +You can find details about contributing [on the site](http://coffeescript-cookbook.github.io/contributing). For now here is a simple formula: 1. Fork the repository at [GitHub](http://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com) 2. Do awesomeness! @@ -16,11 +16,11 @@ You can find details about contributing [on the site](http://coffeescriptcookboo Here are some relevant links from the site. -* [Contributing](http://coffeescriptcookbook.com/contributing) -* [Recipe Template](http://coffeescriptcookbook.com/recipe-template) -* [Author's Guide](http://coffeescriptcookbook.com/authors-guide) -* [Developer's Guide](http://coffeescriptcookbook.com/developers-guide) -* [Designer's Guide](http://coffeescriptcookbook.com/designers-guide) +* [Contributing](http://coffeescript-cookbook.github.io/contributing) +* [Recipe Template](http://coffeescript-cookbook.github.io/recipe-template) +* [Author's Guide](http://coffeescript-cookbook.github.io/authors-guide) +* [Developer's Guide](http://coffeescript-cookbook.github.io/developers-guide) +* [Designer's Guide](http://coffeescript-cookbook.github.io/designers-guide) Jekyll ------ @@ -34,4 +34,4 @@ CoffeeScript Cookbook is currently implemented as a jekyll site. Jekyll is aweso License ------- -This site and all contributions are [licensed](http://coffeescriptcookbook.com/LICENSE-CC-BY) under the Creative Commons Attribution 3.0 Unported (CC BY 3.0) license. By submitting information to this site you agree to grant this license to all users of the site, and that your editing of the authors page constitutes satisfactory attribution. \ No newline at end of file +This site and all contributions are [licensed](http://coffeescript-cookbook.github.io/LICENSE-CC-BY) under the Creative Commons Attribution 3.0 Unported (CC BY 3.0) license. By submitting information to this site you agree to grant this license to all users of the site, and that your editing of the authors page constitutes satisfactory attribution. \ No newline at end of file diff --git a/license.md b/license.md index ae1a2ee..2c473db 100644 --- a/license.md +++ b/license.md @@ -3,6 +3,6 @@ layout: default title: License --- -coffeescriptcookbook.com is licensed under the [Creative Commons Attribution 3.0 Unported (CC BY 3.0)](http://creativecommons.org/licenses/by/3.0/) license. By submitting information to this site you agree to grant this license to all users of the site, and that your editing of the authors page constitutes satisfactory attribution. +coffeescript-cookbook.github.io is licensed under the [Creative Commons Attribution 3.0 Unported (CC BY 3.0)](http://creativecommons.org/licenses/by/3.0/) license. By submitting information to this site you agree to grant this license to all users of the site, and that your editing of the authors page constitutes satisfactory attribution. [LICENSE]({{ site.baseurl }}/LICENSE-CC-BY) From 6ca1c38ce68b8606379f9c189e31aace9afc2c26 Mon Sep 17 00:00:00 2001 From: "Andrey Mikhaylov (lolmaus)" Date: Fri, 9 Jan 2015 19:43:38 +0300 Subject: [PATCH 14/33] Attempting to flush DNS redirect --- CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 CNAME diff --git a/CNAME b/CNAME new file mode 100644 index 0000000..35b04c6 --- /dev/null +++ b/CNAME @@ -0,0 +1 @@ +google.com From abea624c622c4212ff593dc3cf846ff1ca360d6e Mon Sep 17 00:00:00 2001 From: "Andrey Mikhaylov (lolmaus)" Date: Fri, 9 Jan 2015 19:44:30 +0300 Subject: [PATCH 15/33] Attempting to flush DNS redirect, part 2 --- CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 CNAME diff --git a/CNAME b/CNAME deleted file mode 100644 index 35b04c6..0000000 --- a/CNAME +++ /dev/null @@ -1 +0,0 @@ -google.com From 349ba7b718e57c67e41ae425b4636621b96fd485 Mon Sep 17 00:00:00 2001 From: Chase Pursley Date: Mon, 20 Apr 2015 09:52:10 -0400 Subject: [PATCH 16/33] Add square array brackets --- chapters/arrays/reducing-arrays.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chapters/arrays/reducing-arrays.md b/chapters/arrays/reducing-arrays.md index 37d5e98..6b52690 100644 --- a/chapters/arrays/reducing-arrays.md +++ b/chapters/arrays/reducing-arrays.md @@ -24,10 +24,11 @@ You can simply use Array's `reduce()` and `reduceRight()` methods along with an Or it may be something more complex such as aggregating elements from a list into a combined object. {% highlight coffeescript %} -people = +people = [ { name: 'alec', age: 10 } { name: 'bert', age: 16 } { name: 'chad', age: 17 } +] people.reduce (x, y) -> x[y.name]= y.age From 3a21a0d4a801b61d21eb431ea005e3dab4415482 Mon Sep 17 00:00:00 2001 From: Chase Pursley Date: Wed, 22 Apr 2015 19:20:16 -0400 Subject: [PATCH 17/33] Grammar --- chapters/dates_and_times/days-between-two-dates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/dates_and_times/days-between-two-dates.md b/chapters/dates_and_times/days-between-two-dates.md index 11f6894..5b923cb 100644 --- a/chapters/dates_and_times/days-between-two-dates.md +++ b/chapters/dates_and_times/days-between-two-dates.md @@ -5,7 +5,7 @@ chapter: Dates and Times --- ## Problem -You need to find how much seconds minutes, hours, days, months or years has passed between two dates. +You need to find how many seconds minutes, hours, days, months or years has passed between two dates. ## Solution From fa3720bc1b2274608900255bfb8e2ff4d75be419 Mon Sep 17 00:00:00 2001 From: Chase Pursley Date: Wed, 22 Apr 2015 19:21:41 -0400 Subject: [PATCH 18/33] Grammar 2 --- chapters/dates_and_times/days-between-two-dates.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/chapters/dates_and_times/days-between-two-dates.md b/chapters/dates_and_times/days-between-two-dates.md index 5b923cb..def2cc3 100644 --- a/chapters/dates_and_times/days-between-two-dates.md +++ b/chapters/dates_and_times/days-between-two-dates.md @@ -22,12 +22,10 @@ days_passed = Math.round((d2.getTime() - d1.getTime()) / DAY) ## Discussion -Using milliseconds makes the life easier to avoid overflow mistakes with Dates. So we first calculate how much milliseconds has a day. -Then, given two distinct dates, just get the difference in milliseconds between two dates and then divide by how much milliseconds has a -day. It will get you the days between two distinct dates. +Using milliseconds makes the life easier to avoid overflow mistakes with Dates. So we first calculate how many milliseconds are in a day. +Then, given two distinct dates, just get the difference in milliseconds between two dates and then divide by how many milliseconds are in a day. It will return the days between two distinct dates. -If you'd like to calculate the hours between two date objects, you can do that just by dividing the difference in milliseconds by the -conversion of milliseconds to hours. The same goes for minutes and seconds. +If you'd like to calculate the hours between two date objects, you can do that just by dividing the difference in milliseconds by the conversion of milliseconds to hours. The same goes for minutes and seconds. {% highlight coffeescript %} HOUR = 1000 * 60 * 60 From 23520f84a33023d13426ae43699e97caa17eec4d Mon Sep 17 00:00:00 2001 From: Chase Pursley Date: Sat, 25 Apr 2015 12:23:17 -0400 Subject: [PATCH 19/33] Add comma --- chapters/dates_and_times/days-between-two-dates.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/dates_and_times/days-between-two-dates.md b/chapters/dates_and_times/days-between-two-dates.md index def2cc3..d70408f 100644 --- a/chapters/dates_and_times/days-between-two-dates.md +++ b/chapters/dates_and_times/days-between-two-dates.md @@ -5,7 +5,7 @@ chapter: Dates and Times --- ## Problem -You need to find how many seconds minutes, hours, days, months or years has passed between two dates. +You need to find how many seconds, minutes, hours, days, months or years has passed between two dates. ## Solution From 8942bab7bd05eafb1f0afb626b5f73cde9cfe02c Mon Sep 17 00:00:00 2001 From: Chase Pursley Date: Sat, 25 Apr 2015 12:24:48 -0400 Subject: [PATCH 20/33] A few other grammar changes --- chapters/dates_and_times/days-between-two-dates.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/chapters/dates_and_times/days-between-two-dates.md b/chapters/dates_and_times/days-between-two-dates.md index d70408f..b6a94e9 100644 --- a/chapters/dates_and_times/days-between-two-dates.md +++ b/chapters/dates_and_times/days-between-two-dates.md @@ -5,11 +5,11 @@ chapter: Dates and Times --- ## Problem -You need to find how many seconds, minutes, hours, days, months or years has passed between two dates. +You need to find how many seconds, minutes, hours, days, months or years have passed between two dates. ## Solution -Use JavaScript's Date function getTime(). Which provides how much time in milliseconds has passed since 01/01/1970: +Use JavaScript's Date function getTime(). Which provides how much time in milliseconds have passed since 01/01/1970: {% highlight coffeescript %} DAY = 1000 * 60 * 60 * 24 @@ -23,9 +23,9 @@ days_passed = Math.round((d2.getTime() - d1.getTime()) / DAY) ## Discussion Using milliseconds makes the life easier to avoid overflow mistakes with Dates. So we first calculate how many milliseconds are in a day. -Then, given two distinct dates, just get the difference in milliseconds between two dates and then divide by how many milliseconds are in a day. It will return the days between two distinct dates. +Then, given two distinct dates, get the difference in milliseconds between two dates and then divide by how many milliseconds are in a day. It will return the days between two distinct dates. -If you'd like to calculate the hours between two date objects, you can do that just by dividing the difference in milliseconds by the conversion of milliseconds to hours. The same goes for minutes and seconds. +If you'd like to calculate the hours between two date objects, you can do that by dividing the difference in milliseconds by the conversion of milliseconds to hours. The same goes for minutes and seconds. {% highlight coffeescript %} HOUR = 1000 * 60 * 60 From 5738c9f8f958864ab6db67d83f3f14130e09c2fe Mon Sep 17 00:00:00 2001 From: Joel Byrnes Date: Wed, 27 May 2015 12:44:37 -0400 Subject: [PATCH 21/33] Fixed a typo --- chapters/design_patterns/interpreter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/design_patterns/interpreter.md b/chapters/design_patterns/interpreter.md index 0f6ba9d..654c324 100644 --- a/chapters/design_patterns/interpreter.md +++ b/chapters/design_patterns/interpreter.md @@ -140,4 +140,4 @@ send toasted ham turkey sandwich to 'Rachel' # => "Rachel requested a toasted, w send toasted turkey ham swiss sandwich to 'Matt' # => "Matt requested a toasted, white bread sandwich with swiss, ham and turkey" {% endhighlight %} -This example allows for layers of functions by how it returns the modified object so that outer functions can modify it in turn. By borrowing a very and the particle _to_, the example lends natural grammar to the construction and ends up reading like an actual sentence when used correctly. This way, both your CoffeeScript skills and your existing language skills can help catch code problems. +This example allows for layers of functions by how it returns the modified object so that outer functions can modify it in turn. By borrowing a verb and the particle _to_, the example lends natural grammar to the construction and ends up reading like an actual sentence when used correctly. This way, both your CoffeeScript skills and your existing language skills can help catch code problems. From 3e08e7c20af41f8e9a94661be2f86d32bd459d58 Mon Sep 17 00:00:00 2001 From: Joel Byrnes Date: Wed, 27 May 2015 15:52:34 -0400 Subject: [PATCH 22/33] Change "the particle _to_" to read: "the preposition _to" --- chapters/design_patterns/interpreter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/design_patterns/interpreter.md b/chapters/design_patterns/interpreter.md index 654c324..e3fa133 100644 --- a/chapters/design_patterns/interpreter.md +++ b/chapters/design_patterns/interpreter.md @@ -140,4 +140,4 @@ send toasted ham turkey sandwich to 'Rachel' # => "Rachel requested a toasted, w send toasted turkey ham swiss sandwich to 'Matt' # => "Matt requested a toasted, white bread sandwich with swiss, ham and turkey" {% endhighlight %} -This example allows for layers of functions by how it returns the modified object so that outer functions can modify it in turn. By borrowing a verb and the particle _to_, the example lends natural grammar to the construction and ends up reading like an actual sentence when used correctly. This way, both your CoffeeScript skills and your existing language skills can help catch code problems. +This example allows for layers of functions by how it returns the modified object so that outer functions can modify it in turn. By borrowing a verb and the preposition _to_, the example lends natural grammar to the construction and ends up reading like an actual sentence when used correctly. This way, both your CoffeeScript skills and your existing language skills can help catch code problems. From a0f55a3cfebb4e8ce83033f6756df05fa93615d8 Mon Sep 17 00:00:00 2001 From: Sami Pussinen Date: Thu, 10 Dec 2015 08:47:18 +0200 Subject: [PATCH 23/33] Fixed a minor typo in the chaining page. --- chapters/classes_and_objects/chaining.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chapters/classes_and_objects/chaining.md b/chapters/classes_and_objects/chaining.md index be19212..d8d099e 100644 --- a/chapters/classes_and_objects/chaining.md +++ b/chapters/classes_and_objects/chaining.md @@ -66,9 +66,9 @@ class TeaCup cream: false addChainedAttributeAccessor(this, 'properties', attr) for attr of @properties -earlgrey = new TeaCup().size('small').type('Earl Grey').sugar('false') +earlgrey = new TeaCup().size('small').type('Earl Grey').sugar(false) -earlgrey.properties # => { size: 'small', type: 'Earl Grey', sugar: false } +earlgrey.properties # => { size: 'small', type: 'Earl Grey', sugar: false, cream: false } earlgrey.sugar true From 7fa9559f4af96f68e00d956c60267d6fa49b5dac Mon Sep 17 00:00:00 2001 From: Sami Pussinen Date: Thu, 10 Dec 2015 08:48:17 +0200 Subject: [PATCH 24/33] Added myself to the authors page. --- authors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/authors.md b/authors.md index 3b3b236..3d152cd 100644 --- a/authors.md +++ b/authors.md @@ -34,6 +34,7 @@ The following people are totally rad and awesome because they have contributed r * Mike Moore *mike@blowmage.com* * Peter Hellberg *peter@c7.se* * Jamie Gaskins *jgaskins@gmail.com* +* Sami Pussinen *me@samipussinen.com* * ...You! What are you waiting for? Check out the [contributing]({{ site.baseurl }}/contributing) section and get cracking! # Designers From 202bdfdd61c26f34120eae12699b25532fcd0f59 Mon Sep 17 00:00:00 2001 From: Data-Meister Date: Thu, 21 Jan 2016 18:01:17 +0000 Subject: [PATCH 25/33] Add a recipe to count occurrences of a given string within a message --- chapters/strings/finding-substrings.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/chapters/strings/finding-substrings.md b/chapters/strings/finding-substrings.md index a33af8c..5a070d2 100644 --- a/chapters/strings/finding-substrings.md +++ b/chapters/strings/finding-substrings.md @@ -24,8 +24,14 @@ message.indexOf "This", 5 message.lastIndexOf "This" # => 49 -{% endhighlight %} -## Discussion +# Count occurrences of a given string + + substrCount = (str, subStr) -> + re = new RegExp( subStr ,"g" ) + ( str.match(re) or [] ).length -Still need recipe to count occurrences of a given string within a message. +substrCount message, " a " +# => 3 + +{% endhighlight %} From d6da838694e611a73822cdaf667ec5b9530260f3 Mon Sep 17 00:00:00 2001 From: Data-Meister Date: Thu, 28 Jan 2016 17:56:24 +0000 Subject: [PATCH 26/33] Faster, simpler way to count occurrences of a given string --- chapters/strings/finding-substrings.md | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/chapters/strings/finding-substrings.md b/chapters/strings/finding-substrings.md index 5a070d2..ee81e89 100644 --- a/chapters/strings/finding-substrings.md +++ b/chapters/strings/finding-substrings.md @@ -24,14 +24,8 @@ message.indexOf "This", 5 message.lastIndexOf "This" # => 49 - # Count occurrences of a given string - - substrCount = (str, subStr) -> - re = new RegExp( subStr ,"g" ) - ( str.match(re) or [] ).length - -substrCount message, " a " +message.split(" a ").length - 1 # => 3 {% endhighlight %} From fdb756a70280aad027f8213677d067282eb6007c Mon Sep 17 00:00:00 2001 From: Data-Meister Date: Thu, 28 Jan 2016 21:52:23 +0000 Subject: [PATCH 27/33] Add new chapter: replacing sub-strings --- chapters/strings/replacing-sub-strings.md | 29 +++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 chapters/strings/replacing-sub-strings.md diff --git a/chapters/strings/replacing-sub-strings.md b/chapters/strings/replacing-sub-strings.md new file mode 100644 index 0000000..add9945 --- /dev/null +++ b/chapters/strings/replacing-sub-strings.md @@ -0,0 +1,29 @@ +--- +layout: recipe +title: Replacing Sub-Strings Within a String +chapter: Strings +--- +## Problem + +You want to replace a sub-string with a new sub-string. + +## Solution + +Split the string using the sub-string you want to remove as a delimiter. Then re-join using the new sub-string as the delimiter. + +{% highlight coffeescript %} +"Orange is the new Black".split("Orange").join("Pink") +# => "Pink is the new Black" + +"I am so sad. I cannot believe how sad I am today!".split("sad").join("happy") +# => "I am so happy. I cannot believe how happy I am today!" + +"I am not a crook.".split("not ").join("") +# => "I am a crook." +{% endhighlight %} + +## Discussion + +You can also use regexes. If you're matching an exact string, this way is simpler and 10x faster. + +If you use regexes, remember that you must escape certain characters. From 9b10230f4b5c76486b201b90802fa0141e4001e3 Mon Sep 17 00:00:00 2001 From: tijwelch Date: Tue, 6 Sep 2016 06:12:18 -0500 Subject: [PATCH 28/33] Fix typo in syntax chapter --- chapters/syntax/code_reuse_on_client_and_server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chapters/syntax/code_reuse_on_client_and_server.md b/chapters/syntax/code_reuse_on_client_and_server.md index f7a1aca..92e706b 100644 --- a/chapters/syntax/code_reuse_on_client_and_server.md +++ b/chapters/syntax/code_reuse_on_client_and_server.md @@ -57,7 +57,7 @@ undefined {% endhighlight %} -In our web page, we can include our module using by including it as a script. +In our web page, we can include our module by including it as a script. {% highlight html %} From e3fbf9fa83336611571500c42361fb7b4194ef7f Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Wed, 11 Jan 2017 09:09:34 -0700 Subject: [PATCH 29/33] Update development dependencies The versions of gems specified in the Gemfile.lock require ruby 1.9.3. Update them to the latest and greatest gems. --- Gemfile | 4 +- Gemfile.lock | 178 +++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 131 insertions(+), 51 deletions(-) diff --git a/Gemfile b/Gemfile index b4d66ba..b700031 100644 --- a/Gemfile +++ b/Gemfile @@ -4,6 +4,6 @@ group :development do gem "github-pages" gem "tzinfo-data" - gem "foreman", "~> 0.63" - gem "serve", "~> 1.5" + gem "foreman" + gem "serve" end diff --git a/Gemfile.lock b/Gemfile.lock index d8185b6..682c357 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,56 +2,125 @@ GEM remote: https://rubygems.org/ specs: RedCloth (4.2.9) - activesupport (3.2.14) + activesupport (3.2.22.5) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - classifier (1.3.3) - fast-stemmer (>= 1.0.0) + addressable (2.4.0) + blankslate (2.1.2.4) + classifier-reborn (2.1.0) + fast-stemmer (~> 1.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) colorator (0.1) - commander (4.1.5) - highline (~> 1.6.11) - directory_watcher (1.4.1) - dotenv (0.8.0) + ethon (0.10.1) + ffi (>= 1.3.0) + execjs (2.7.0) + faraday (0.10.1) + multipart-post (>= 1.2, < 3) fast-stemmer (1.0.2) - foreman (0.63.0) - dotenv (>= 0.7) - thor (>= 0.13.6) - github-pages (1) + ffi (1.9.14) + foreman (0.82.0) + thor (~> 0.19.1) + gemoji (2.1.0) + github-pages (39) RedCloth (= 4.2.9) - jekyll (= 1.1.2) - kramdown (= 1.0.2) - liquid (= 2.5.1) - maruku (= 0.6.1) - rdiscount (= 1.6.8) - redcarpet (= 2.2.2) - highline (1.6.19) - i18n (0.6.5) - jekyll (1.1.2) - classifier (~> 1.3) + github-pages-health-check (~> 0.2) + jekyll (= 2.4.0) + jekyll-coffeescript (= 1.0.1) + jekyll-feed (= 0.3.1) + jekyll-mentions (= 0.2.1) + jekyll-redirect-from (= 0.8.0) + jekyll-sass-converter (= 1.3.0) + jekyll-sitemap (= 0.8.1) + jemoji (= 0.5.0) + kramdown (= 1.5.0) + liquid (= 2.6.2) + maruku (= 0.7.0) + mercenary (~> 0.3) + pygments.rb (= 0.6.3) + rdiscount (= 2.1.7) + redcarpet (= 3.3.2) + terminal-table (~> 1.4) + github-pages-health-check (0.3.2) + net-dns (~> 0.6) + public_suffix (~> 1.4) + typhoeus (~> 0.7) + html-pipeline (1.9.0) + activesupport (>= 2) + nokogiri (~> 1.4) + i18n (0.7.0) + jekyll (2.4.0) + classifier-reborn (~> 2.0) colorator (~> 0.1) - commander (~> 4.1.3) - directory_watcher (~> 1.4.1) - kramdown (~> 1.0.2) - liquid (~> 2.5.1) - maruku (~> 0.5) - pygments.rb (~> 0.5.0) - redcarpet (~> 2.2.2) - safe_yaml (~> 0.7.0) - kramdown (1.0.2) - liquid (2.5.1) - maruku (0.6.1) - syntax (>= 1.0.0) - multi_json (1.7.9) - posix-spawn (0.3.6) - pygments.rb (0.5.2) + jekyll-coffeescript (~> 1.0) + jekyll-gist (~> 1.0) + jekyll-paginate (~> 1.0) + jekyll-sass-converter (~> 1.0) + jekyll-watch (~> 1.1) + kramdown (~> 1.3) + liquid (~> 2.6.1) + mercenary (~> 0.3.3) + pygments.rb (~> 0.6.0) + redcarpet (~> 3.1) + safe_yaml (~> 1.0) + toml (~> 0.1.0) + jekyll-coffeescript (1.0.1) + coffee-script (~> 2.2) + jekyll-feed (0.3.1) + jekyll-gist (1.4.0) + octokit (~> 4.2) + jekyll-mentions (0.2.1) + html-pipeline (~> 1.9.0) + jekyll (~> 2.0) + jekyll-paginate (1.1.0) + jekyll-redirect-from (0.8.0) + jekyll (>= 2.0) + jekyll-sass-converter (1.3.0) + sass (~> 3.2) + jekyll-sitemap (0.8.1) + jekyll-watch (1.5.0) + listen (~> 3.0, < 3.1) + jemoji (0.5.0) + gemoji (~> 2.0) + html-pipeline (~> 1.9) + jekyll (>= 2.0) + kramdown (1.5.0) + liquid (2.6.2) + listen (3.0.8) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + maruku (0.7.0) + mercenary (0.3.6) + mini_portile2 (2.1.0) + multi_json (1.12.1) + multipart-post (2.0.0) + net-dns (0.8.0) + nokogiri (1.7.0.1) + mini_portile2 (~> 2.1.0) + octokit (4.6.2) + sawyer (~> 0.8.0, >= 0.5.3) + parslet (1.5.0) + blankslate (~> 2.0) + posix-spawn (0.3.12) + public_suffix (1.5.3) + pygments.rb (0.6.3) posix-spawn (~> 0.3.6) - yajl-ruby (~> 1.1.0) - rack (1.5.2) - rack-test (0.6.2) + yajl-ruby (~> 1.2.0) + rack (1.5.5) + rack-test (0.6.3) rack (>= 1.0) - rdiscount (1.6.8) - redcarpet (2.2.2) - safe_yaml (0.7.1) + rb-fsevent (0.9.8) + rb-inotify (0.9.7) + ffi (>= 0.5.0) + rdiscount (2.1.7) + redcarpet (3.3.2) + safe_yaml (1.0.4) + sass (3.4.23) + sawyer (0.8.1) + addressable (>= 2.3.5, < 2.6) + faraday (~> 0.8, < 1.0) serve (1.5.2) activesupport (~> 3.2.12) i18n @@ -59,19 +128,30 @@ GEM rack-test (~> 0.6.2) tilt (~> 1.3.3) tzinfo - syntax (1.0.0) - thor (0.18.1) + terminal-table (1.7.3) + unicode-display_width (~> 1.1.1) + thor (0.19.4) + thread_safe (0.3.5) tilt (1.3.7) - tzinfo (1.0.1) - tzinfo-data (1.2013.4) + toml (0.1.2) + parslet (~> 1.5.0) + typhoeus (0.8.0) + ethon (>= 0.8.0) + tzinfo (1.2.2) + thread_safe (~> 0.1) + tzinfo-data (1.2016.10) tzinfo (>= 1.0.0) - yajl-ruby (1.1.0) + unicode-display_width (1.1.2) + yajl-ruby (1.2.1) PLATFORMS ruby DEPENDENCIES - foreman (~> 0.63) + foreman github-pages - serve (~> 1.5) + serve tzinfo-data + +BUNDLED WITH + 1.13.7 From 482af694b205f9213c2c89c1497f9989cd986aaa Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Wed, 11 Jan 2017 09:11:05 -0700 Subject: [PATCH 30/33] Use new Jekyll configuration for code highlighting This removes the following warning: Deprecation: The 'pygments' configuration option has been renamed to 'highlighter'. Please update your config file accordingly. The allowed values are 'rouge', 'pygments' or null. --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 6214b0c..20fa234 100644 --- a/_config.yml +++ b/_config.yml @@ -1,6 +1,6 @@ baseurl: '' safe: true -pygments: true +highlighter: pygments lsi: false markdown: redcarpet exclude: From 50515c7deeefe5ac55d390740d0961f953ac9d7f Mon Sep 17 00:00:00 2001 From: Mike Moore Date: Wed, 11 Jan 2017 09:30:37 -0700 Subject: [PATCH 31/33] Replace page data with site data --- _data/chapters.yml | 16 ++++++++++++++++ _layouts/chapter.html | 22 +--------------------- _layouts/default.html | 22 +--------------------- _layouts/recipe.html | 22 +--------------------- chapters/index.html | 20 ++------------------ 5 files changed, 21 insertions(+), 81 deletions(-) create mode 100644 _data/chapters.yml diff --git a/_data/chapters.yml b/_data/chapters.yml new file mode 100644 index 0000000..9c47918 --- /dev/null +++ b/_data/chapters.yml @@ -0,0 +1,16 @@ +--- +- Syntax +- Classes and Objects +- Strings +- Arrays +- Dates and Times +- Math +- Functions +- Metaprogramming +- jQuery +- Ajax +- Regular Expressions +- Networking +- Design Patterns +- Databases +- Testing diff --git a/_layouts/chapter.html b/_layouts/chapter.html index 3023ec9..3daeeed 100644 --- a/_layouts/chapter.html +++ b/_layouts/chapter.html @@ -1,22 +1,3 @@ ---- -chapters: -- Syntax -- Classes and Objects -- Strings -- Arrays -- Dates and Times -- Math -- Functions -- Metaprogramming -- jQuery -- Ajax -- Regular Expressions -- Networking -- Design Patterns -- Databases -- Testing ---- - @@ -72,7 +53,7 @@
            ó