Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert guides to Markdown

For the same reasons the recipes were changed.
  • Loading branch information...
commit 343fbde7b98a145b037bb9b84c02ec57a2359b13 1 parent 476f889
@blowmage blowmage authored
View
3  LICENSE-CC-BY.textile
@@ -20,6 +20,7 @@ BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE B
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
+
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
@@ -40,6 +41,7 @@ The above rights may be exercised in all media and formats whether now known or
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(b), as requested.
If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4 (b) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
+
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
@@ -50,6 +52,7 @@ UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS T
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
+
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
View
6 _config.yml
@@ -1,12 +1,10 @@
pygments: true
lsi: false
exclude:
- - README
+ - README.md
- CNAME
- - TODO.textile
+ - TODO.md
- script
- Procfile
- Gemfile
- Gemfile.lock
-
-
View
94 authors-guide.textile → authors-guide.md
@@ -2,15 +2,13 @@
layout: default
title: Author's Guide
---
+# Author's Guide
-h1. Author's Guide
+## tl;dr: Look at Other Recipes, and Blend In
-h2. 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 <a href="/developers-guide">Developer's Guide</a> to get a test version of the cookbook up and running on your machine, and get to work!
-
-
-h2. General Guidelines
+## General Guidelines
* Feel free to add new pages, or even chapters. Just keep them organized. _(See "How to Add a Chapter" below)_
* Try to write well-styled, idiomatic CoffeeScript.
@@ -18,44 +16,43 @@ h2. General Guidelines
* Sharing code that you think might only be used rarely is fine. Sharing esoteric code tricks is less so. There's a difference between sharing a translator for an obscure format and sharing a weird bit-shifting trick that does fast but inaccurate multiplication.
* Don't forget to add your name to the authors page!
-h2. Use Cookbook Problem/Solution/Discussion Format
+## Use Cookbook Problem/Solution/Discussion Format
A typical cookbook page will have three sections (four if you count the title):
-* +Problem+ A one- or two-sentence description of the problem, such as "You want to access parts of a string" or "You want to format a floating point number as currency, with a leading dollar sign, two digits of precision and comma-separated triples." Where possible, phrase the problem as though speaking directly to the reader: "You want to...", "You have an X but you want a Y", etc.
-* +Solution+ State the solution as briefly as possible, ideally as a single sentence that identifies the strategy you would use, and give example code. It's tempting to explain the solution, but don't do it yet. Remember that the reader will look this solution up many times after the first time, and that they will be looking for a quick reference each time. You're going to explain the solution in the +Discussion+, and the first time reader will read your solution, think about it, and then proceed to the discussion if necessary. For example, for "accessing parts of a string", a good Solution sentence might be "Use CoffeeScript's array range subscripts, or JavaScript's slice function."
-* +Discussion+ Here you should explain why your solution works, or give further examples such as edge cases. If your solution can break on some edge cases, be sure to note them here. For example, if a percentage function crashes when given a zero, you could note this in the discussion and give a workaround. NOTE: If your solution has really dangerous edge cases, so dangerous that you would include them in the solution, please consider whether your recipe should be included at all. Remember, this Cookbook is for good code!
-
+* **Problem** A one- or two-sentence description of the problem, such as "You want to access parts of a string" or "You want to format a floating point number as currency, with a leading dollar sign, two digits of precision and comma-separated triples." Where possible, phrase the problem as though speaking directly to the reader: "You want to...", "You have an X but you want a Y", etc.
+* **Solution** State the solution as briefly as possible, ideally as a single sentence that identifies the strategy you would use, and give example code. It's tempting to explain the solution, but don't do it yet. Remember that the reader will look this solution up many times after the first time, and that they will be looking for a quick reference each time. You're going to explain the solution in the **Discussion**, and the first time reader will read your solution, think about it, and then proceed to the discussion if necessary. For example, for "accessing parts of a string", a good Solution sentence might be "Use CoffeeScript's array range subscripts, or JavaScript's slice function."
+* **Discussion** Here you should explain why your solution works, or give further examples such as edge cases. If your solution can break on some edge cases, be sure to note them here. For example, if a percentage function crashes when given a zero, you could note this in the discussion and give a workaround. NOTE: If your solution has really dangerous edge cases, so dangerous that you would include them in the solution, please consider whether your recipe should be included at all. Remember, this Cookbook is for good code!
-h2. Copyright Issues
+## 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 <a href="/license">CC BY 3.0</a> license. If you DO have permission and the author would like credit, please add them to the <a href="/authors">authors</a> 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](/license) license. If you DO have permission and the author would like credit, please add them to the [authors](/authors) page.
-Also, just a stylistic note, please do not yank code directly from 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 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.
+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.
-
-h2. Tag the page with Jekyll frontmatter
+## Tag the page with Jekyll frontmatter
...that's a lot of fancy words that mean "don't forget to put the layout, chapter and page title at the top of the file in a YAML block". For example, the string interpolation page begins with
-<tt>---
+{% highlight text %}
+---
layout: recipe
title: String Interpolation
chapter: Strings
----</tt>
-
+---
+{% endhighlight %}
-h2. Use Liquid highlighting templates
+## Use Liquid highlighting templates
-Turn on syntax highlighting for CoffeeScript with <tt>highlight coffeescript</tt>.
+Turn on syntax highlighting for CoffeeScript with `highlight coffeescript`.
-<tt>&lbrace;% highlight coffeescript %&rbrace;
+<div class="highlight"><pre><code>&lbrace;% highlight coffeescript %&rbrace;
&#35; Calculate the square of a number
square = (x) -> x * x
square(16)
&#35; => 256
-&lbrace;% endhighlight %&rbrace;</tt>
+&lbrace;% endhighlight %&rbrace;</code></pre></div>
This produces the following:
@@ -67,10 +64,9 @@ square(16)
# => 256
{% endhighlight %}
+## Include Output
-h2. Include Output
-
-After writing an important expression, show the reader what the output would be by adding it with a <tt># =></tt> on the following line. Once we get automated script testing working up in this joint, we'll actually load up your recipe snippets and evaluate its expressions against the output comment you wrote. (In other words, <tt># =></tt> tells the reader what the output will be, but it tells automated checker what the assertEquals should be)
+After writing an important expression, show the reader what the output would be by adding it with a `# =>` on the following line. Once we get automated script testing working up in this joint, we'll actually load up your recipe snippets and evaluate its expressions against the output comment you wrote. (In other words, `# =>` tells the reader what the output will be, but it tells automated checker what the assertEquals should be)
{% highlight coffeescript %}
# right
@@ -97,12 +93,11 @@ Not all snippets evaluate to something useful. For example, array.forEach has si
When in doubt about what output to show, try evaluating your snippet in the coffee interpreter and see what IT thinks. Ideally your output should match, or at least be machine-comparable.
+# Grindy HOWTOs
-h1. Grindy HOWTOs
+## How to Add a Recipe
-h2. How to Add a Recipe
-
-Create a new textile page (or copy the <a href="/recipe-template">Recipe Template</a>. The filename should be about the problem, e.g. <tt>finding-last-day-of-the-month.textile</tt> or <tt>reversing-arrays.textile</tt>. In your file, start with the following template:
+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:
{% highlight text %}
---
@@ -111,27 +106,26 @@ title: Title of The Recipe
chapter: Chapter Name
---
-h2. Problem
+## Problem
You have a problem.
-h2. Solution
+## Solution
Do this about it.
-h2. Discussion
+## Discussion
Here's why.
{% endhighlight %}
One fussy little bit, the chapter name should match the directory the chapter is in, otherwise the page won't render correctly. For example, if you're writing a recipe for arrays, make sure the chapter is "Arrays", not "arrays" or "aray" ...or especially not "Chapter Name".
+## How to Add a Chapter
-h2. How to Add a Chapter
-
-* Open chapters/index.textile and your chapter's name to the yaml list of chapters.
+* Open chapters/index.html and your chapter's name to the yaml list of chapters.
* cd into chapters/ and create the directory for the chapter name. Downcase the name and replace spaces with underscores.
-* add an index.textile file that uses <tt>layout: chapter</tt>. For convenience, just copy the index.textile from another chapter and update the yaml frontmatter to reflect the name of your new chapter.
+* add an index.html file that uses `layout: chapter`. For convenience, just copy the index.html from another chapter and update the yaml frontmatter to reflect the name of your new chapter.
For example, to add a chapter called "Dates and Times", you would add it to the chapters array:
@@ -152,13 +146,11 @@ mkdir dates_and_times
Now create a new page in that chapter (remember to add its YAML front matter) and once jekyll regenerates the chapter index, your new page should appear.
+# FAQ
-h1. FAQ
-
+## I Have a Weird Recipe. Should I Share It?
-h2. I Have a Weird Recipe. Should I Share It?
-
-Maybe! The real question is, is it really useful, or is it just clever? If you have a formatter for a weird Albanian GIS format, that's a real problem that almost nobody would ever have&mdash;but when somebody DOES have that problem, they REALLY need a solution. If you have a bit shifting trick that can swap two numbers using three xor-equals operations, that's a really clever solution but it's not very good CoffeeScript. (For one thing, <tt>x ^= y ^= x ^= y</tt> is not idiomatic, while <tt>[x,y]=[y,x]</tt> is. For another, there's a bug in that code. And once you fix it, there's another bug caused by extrapolating this register trick to a reference-based language where&mdash;look, it's just a bad idea, okay?)
+Maybe! The real question is, is it really useful, or is it just clever? If you have a formatter for a weird Albanian GIS format, that's a real problem that almost nobody would ever have -- but when somebody DOES have that problem, they REALLY need a solution. If you have a bit shifting trick that can swap two numbers using three xor-equals operations, that's a really clever solution but it's not very good CoffeeScript. (For one thing, `x ^= y ^= x ^= y` is not idiomatic, while `[x,y]=[y,x]` is. For another, there's a bug in that code. And once you fix it, there's another bug caused by extrapolating this register trick to a reference-based language where -- look, it's just a bad idea, okay?)
If you have a cool but weird recipe, ask yourself if a reader would genuinely find it useful. Here are two very good questions to consider:
@@ -167,28 +159,22 @@ If you have a cool but weird recipe, ask yourself if a reader would genuinely fi
If the answer to either question is no, you might have some code that is a "clever solution in search of a problem". If in doubt, ask.
-
-h2. What If My Recipe is Inefficient/Too Big/Too Slow?
+## What If My Recipe is Inefficient/Too Big/Too Slow?
If it solves a problem to which the alternative is to _not_ solve the problem, share it. Let the reader decide if they want to use it. Sometimes we want tight efficient code, other times we want a robust featureset. If the code has abysmal performance characteristics, be sure to warn the reader in the Discussion.
-
-h2. Can I Edit An Existing Recipe?
+## Can I Edit An Existing Recipe?
Yes. Please improve anything and everything! Be sure to test your changes and make sure that your solution really is better.
-
-h2. I Have a Really Efficient Solution, But It's Not As Readable As the Existing Recipe. Should I Add It?
+## I Have a Really Efficient Solution, But It's Not As Readable As the Existing Recipe. Should I Add It?
See the "Weird Recipe" note above. Do real people in the real world ever hit the performance constraint? If so, then by all means, add your strategy to the existing solution, and be sure to explain why your solution is not idiomatic. If a reader really has that problem, they'll be glad for the extra options.
+## I Have A Problem/Solution, But It's Basically Just JavaScript. Should I Add It?
-h2. 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 <a href="/chapters/arrays/reversing-arrays">Reversing Arrays</a>.) 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&mdash;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](/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.
-
-h2. I Found a Typo. Is That Enough of a Fix? Does That Count?
+## I Found a Typo. Is That Enough of a Fix? Does That Count?
Absolutely!
-
View
33 authors.md
@@ -0,0 +1,33 @@
+---
+layout: default
+title: Authors
+---
+
+# Authors
+
+The following people are totally rad and awesome because they have contributed recipes!
+
+* David Brady _ratgeyser@gmail.com_
+* John Ford _jwford@gmail.com_
+* Steven Reid _steven @ reidnorthwest . com_
+* David Moulton _dave@themoultons.net_
+* Sebastian Slomski _sebastian@simple-systems.org_
+* Aaron Weinberger _aw9994@cs.ship.edu_
+* James C. Holder _cs_cookbook@thirdtruck.org_
+* Jason Giedymin _jasong@apache.org_
+* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking!
+
+# Developers
+
+_The following people are amazingly rad and awesome because they have helped fix the code for the site!_
+
+* David Brady _ratgeyser@gmail.com_
+* Mike Moore _mike@blowmage.com_
+* Peter Hellberg _peter@c7.se_
+* ...You! What are you waiting for? Check out the [contributing](/contributing) section and get cracking!
+
+# Designers
+
+The following people are astonishingly rad and awesome because they did great design for the site!
+
+* Oh please SOMEBODY put their name here! Check out the [contributing](/contributing) section and get cracking!
View
36 authors.textile
@@ -1,36 +0,0 @@
----
-layout: default
-title: Authors
----
-
-h1. Authors
-
-_The following people are totally rad and awesome because they have contributed recipes!_
-
-* David Brady _ratgeyser@gmail.com_
-* John Ford _jwford@gmail.com_
-* Steven Reid _steven @ reidnorthwest . com_
-* David Moulton _dave@themoultons.net_
-* Sebastian Slomski _sebastian@simple-systems.org_
-* Aaron Weinberger _aw9994@cs.ship.edu_
-* James C. Holder _cs_cookbook@thirdtruck.org_
-* Jason Giedymin _jasong@apache.org_
-* ...You! What are you waiting for? Check out the <a href="/contributing">contributing</a> section and get cracking!
-
-
-h1. Developers
-
-_The following people are amazingly rad and awesome because they have helped fix the code for the site!_
-
-* David Brady _ratgeyser@gmail.com_
-* Mike Moore _mike@blowmage.com_
-* Peter Hellberg _peter@c7.se_
-* ...You! What are you waiting for? Check out the <a href="/contributing">contributing</a> section and get cracking!
-
-
-h1. Designers
-
-_The following people are astonishingly rad and awesome because they did great design for the site!_
-
-* Oh please SOMEBODY put their name here! Check out the <a href="/contributing">contributing</a> section and get cracking!
-
View
106 chapters/dates_and_times/date-of-thanksgiving.md
@@ -48,112 +48,6 @@ thanksgivingDayCA(2012) # => 8 (October 8th)
{% endhighlight %}
The idea is very simple:
-* Find out what day of the week is the first day of respective month (November for USA, October for Canada).
-* Calculate offset from that day to the next occurrence of weekday required (Thursday for USA, Monday for Canada).
-* Add that offset to the first possible date of the holiday (22nd for USA Thanksgiving, 8th for Canada).
----
-layout: recipe
-title: Calculate the date of Thanksgiving (USA and Canada)
-chapter: Dates and Times
----
-## Problem
-
-You need to calculate when is Thanksgivinig in given year.
-
-## Solution
-
-The following functions return the day of Thanksgiving for a given year. If no year is given then current year is used.
-
-In the USA Thanksgiving is celebrated on the fourth Thursday in November:
-
-{% highlight coffeescript %}
-
-thanksgivingDayUSA = (year = (new Date).getFullYear()) ->
- first = new Date year, 10, 1
- day_of_week = first.getDay()
- 22 + (11 - day_of_week) % 7
-
-{% endhighlight %}
-
-In Canada it is the second Monday in October:
-
-{% highlight coffeescript %}
-
-thanksgivingDayCA = (year = (new Date).getFullYear()) ->
- first = new Date year, 9, 1
- day_of_week = first.getDay()
- 8 + (8 - day_of_week) % 7
-
-{% endhighlight %}
-
-## Discussion
-
-{% highlight coffeescript %}
-
-thanksgivingDayUSA() #=> 24 (November 24th, 2011)
-
-thanksgivingDayCA() # => 10 (October 10th, 2011)
-
-thanksgivingDayUSA(2012) # => 22 (November 22nd)
-
-thanksgivingDayCA(2012) # => 8 (October 8th)
-
-{% endhighlight %}
-
-The idea is very simple:
-* Find out what day of the week is the first day of respective month (November for USA, October for Canada).
-* Calculate offset from that day to the next occurrence of weekday required (Thursday for USA, Monday for Canada).
-* Add that offset to the first possible date of the holiday (22nd for USA Thanksgiving, 8th for Canada).
----
-layout: recipe
-title: Calculate the date of Thanksgiving (USA and Canada)
-chapter: Dates and Times
----
-## Problem
-
-You need to calculate when is Thanksgivinig in given year.
-
-## Solution
-
-The following functions return the day of Thanksgiving for a given year. If no year is given then current year is used.
-
-In the USA Thanksgiving is celebrated on the fourth Thursday in November:
-
-{% highlight coffeescript %}
-
-thanksgivingDayUSA = (year = (new Date).getFullYear()) ->
- first = new Date year, 10, 1
- day_of_week = first.getDay()
- 22 + (11 - day_of_week) % 7
-
-{% endhighlight %}
-
-In Canada it is the second Monday in October:
-
-{% highlight coffeescript %}
-
-thanksgivingDayCA = (year = (new Date).getFullYear()) ->
- first = new Date year, 9, 1
- day_of_week = first.getDay()
- 8 + (8 - day_of_week) % 7
-
-{% endhighlight %}
-
-## Discussion
-
-{% highlight coffeescript %}
-
-thanksgivingDayUSA() #=> 24 (November 24th, 2011)
-
-thanksgivingDayCA() # => 10 (October 10th, 2011)
-
-thanksgivingDayUSA(2012) # => 22 (November 22nd)
-
-thanksgivingDayCA(2012) # => 8 (October 8th)
-
-{% endhighlight %}
-
-The idea is very simple:
1. Find out what day of the week is the first day of respective month (November for USA, October for Canada).
2. Calculate offset from that day to the next occurrence of weekday required (Thursday for USA, Monday for Canada).
3. Add that offset to the first possible date of the holiday (22nd for USA Thanksgiving, 8th for Canada).
View
30 contributing.md
@@ -0,0 +1,30 @@
+---
+layout: default
+title: Contributing
+---
+# Contributing
+
+The Cookbook needs your help!
+
+Here's the Contribution Recipe:
+
+1. Fork the repository at [https://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com](https://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com)
+2. Do awesomeness!
+3. Send a pull request to coffeescript-cookbook
+4. If we merge your pull request, you get commit access. BAM. Go back to step 2 and stay there as long as you want.
+
+## 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!
+
+## 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).
+
+## 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).
+
+## 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).
View
32 contributing.textile
@@ -1,32 +0,0 @@
----
-layout: default
-title: Contributing
----
-h1. Contributing
-
-The Cookbook needs your help!
-
-Here's the Contribution Recipe:
-
-# Fork the repository at <a href="http://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com">http://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com</a>
-# Do awesomeness!
-# Send a pull request to coffeescript-cookbook
-# If we merge your pull request, you get commit access. BAM. Go back to step 2 and stay there as long as you want.
-
-
-h2. 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 <a href="/wanted-recipes">Wanted Recipes</a> page!
-
-h2. Authors
-
-Write recipes! Fork the repository, author some pages, and send us a pull request. For more information read the <a href="/authors-guide">author's guide</a>.
-
-h2. Developers
-
-Improve the code! Fork the repository, extend or improve the site coded, and send a pull request. For more information read the <a href="/developers-guide">developer's guide</a>.
-
-h2. 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 <a href="/designers-guide">designer's guide</a>.
-
View
5 designers-guide.textile → designers-guide.md
@@ -3,13 +3,12 @@ layout: default
title: Designer's Guide
---
-h1. Designer's Guide
+# Designer's Guide
-Start with the <a href="/developers-guide">Developer's Guide</a> to get a test version of the cookbook up and running on your machine, and get started!
+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!
First designer to actually DO some design gets to write this page!
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...
...welcome home.
-
View
34 developers-guide.textile → developers-guide.md
@@ -3,23 +3,23 @@ layout: default
title: Developer's Guide
---
-h1. Developer's Guide
+# Developer's Guide
_Please help out by updating this page_
-h3. Operating System
+### Operating System
It works on Mac OSX. Probably works without any changes or issues on linux. A masochist could probably get it working on Windows.
-h2. Installation
+## Installation
-h3. Clone the repo
+### Clone the repo
{% highlight bash %}
git clone git://github.com/coffeescript-cookbook/coffeescript-cookbook.github.com.git
{% endhighlight %}
-h3. Create a Ruby Gemset
+### Create a Ruby Gemset
Optional, but highly recommended.
@@ -28,16 +28,16 @@ $ rvm gemset create jekyll
$ echo 'rvm gemset use jekyll' >> .rvmrc
{% endhighlight %}
-h3. Install Required Gems
+### Install Required Gems
{% highlight bash %}
gem install jekyll # needed for testing building the site
-gem install RedCloth # needed for .textile rendering
+gem install RedCloth # needed for .md rendering
gem install serve # needed for resolving .html files w/o extension
gem install thin # optional; more efficient webserver than Webrick but not strictly necessary
{% endhighlight %}
-h3. Install pygments
+### Install pygments
You'll need python installed for this. Macs and most linuces come with it preinstalled.
@@ -45,9 +45,9 @@ You'll need python installed for this. Macs and most linuces come with it preins
easy_install pygments # for syntax highlighting
{% endhighlight %}
-h2. Building and Viewing the Website
+## Building and Viewing the Website
-h3. Run jekyll
+### Run jekyll
Open a terminal window, cd into the project folder and run jekyll from the project root.
@@ -55,20 +55,18 @@ Open a terminal window, cd into the project folder and run jekyll from the proje
jekyll --auto
{% endhighlight %}
-Leave this window running while you work. Any time you change a file, jekyll will rerender it into the <tt>_site</tt> folder.
+Leave this window running while you work. Any time you change a file, jekyll will rerender it into the `_site` folder.
-h3. Run serve
+### Run serve
-Open another terminal window, cd into the project folder, then cd into the <tt>_site</tt> subfolder, and run
+Open another terminal window, cd into the project folder, then cd into the `_site` subfolder, and run
{% highlight bash %}
serve
{% endhighlight %}
-This will start a webserver in the <tt>_site</tt> folder. Open a browser and visit <tt>http://localhost:4000/</tt> and you should see the site.
-
-h2. Minituiae and Other Trivialities
-
-jekyll can take a second or two to catch up when you save a file. If you edit a file and don't see the changes in your browser, give it a second or two and try again.
+This will start a webserver in the `_site` folder. Open a browser and visit `http://localhost:4000/` and you should see the site.
+## Minituiae and Other Trivialities
+jekyll can take a second or two to catch up when you save a file. If you edit a file and don't see the changes in your browser, give it a second or two and try again. You may also see Maruku warnings, but as long as it prints `Successfully generated site` you should be alright.
View
8 license.md
@@ -0,0 +1,8 @@
+---
+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.
+
+[LICENSE](/LICENSE-CC-BY)
View
9 license.textile
@@ -1,9 +0,0 @@
----
-layout: default
-title: License
----
-
-coffeescriptcookbook.com is licensed under the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported (CC BY 3.0)</a> 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.
-
-<a href="/LICENSE-CC-BY">LICENSE</a>
-
View
17 recipe-template.textile → recipe-template.md
@@ -3,28 +3,25 @@ layout: default
title: Recipe Template
---
-h2. Sample recipe template
+## Sample recipe template
-Create a new *my_recipe.textile* file and use this text as a start.
+Create a new _my_recipe.md_ file and use this text as a start.
-<pre>
+{% highlight text %}
---
layout: recipe
title: Title of The Recipe
chapter: Chapter Name
---
-
-h2. Problem
+## Problem
You have a problem.
-
-h2. Solution
+## Solution
Do this about it.
-
-h2. Discussion
+## Discussion
Here's why.
-</pre>
+{% endhighlight %}
View
1  terms-of-use.textile → terms-of-use.md
@@ -3,4 +3,3 @@ layout: default
title: Terms of Use
---
-
View
28 wanted-recipes.textile → wanted-recipes.md
@@ -2,19 +2,19 @@
layout: default
title: Wanted Recipes
---
-h1. Wanted Recipes
+# Wanted Recipes
Here's a list of recipes we think we need. Pick one, implement it, and remove it from the page. Alternately, add a quick note here for a recipe you'd like to see so someone else can add it.
In the notes below, "JS" means the recipe is just a simple passthrough to an existing JavaScript method.
-h2. Syntax
+## Syntax
* Ensuring variables are closed over # with "do"
-h2. Objects
+## Objects
-h2. Strings
+## Strings
* HTML methods # JS .sup(), .sub(), .blink(), .link(url), etc. May not exist in your JS impl!
* substr # str.substr(x,y) === str[x..x+y-1] === str[x...x+y]
@@ -24,7 +24,7 @@ h2. Strings
* Replacing substrings
* Trimming whitespace from the end of a string
-h2. Arrays
+## Arrays
* Testing every element in an array
{% highlight coffeescript %}
@@ -39,12 +39,12 @@ evens.every even
* Creating a string from an array
* Replace all duplicates of an array
-h2. Dates and Times
+## Dates and Times
* Calculating the phase of the moon
* Number of days between two dates
-h2. Math
+## Math
* square root # JS Math.sqrt
* Constants # JS Math.PI, Math.E
@@ -55,7 +55,7 @@ h2. Math
* Exponents # Math.exp
* Check if a creditcard is valid (checksum, Luhn algorithm)
-h2. Functions
+## Functions
* Nested functions
@@ -84,25 +84,25 @@ foo 1, 2, 3
# => 6
{% endhighlight %}
-h2. jQuery
+## jQuery
-h2. Regular Expressions
+## Regular Expressions
* Searching for substrings # "foo bar baz".match(/ba./) # => [ 'bar', index: 4, input: 'foo bar baz' ]
* Searching for substrings # "foo bar baz".search(/ba./) # => 4
* Replacing substrings # "foo bar baz".replace( /ba./, 'foo') # => "foo foo baz"
* Replace HTML tags with named HTML entities # <br/> => &lt;br/&gt;
-h2. Networking
+## Networking
* Basic HTTP server
* Basic HTTP client
-h2. AJAX
+## AJAX
* Getting data from a remote server # using raw XHTTPRequest instead of jQuery's $.ajax
-h2. Design patterns
+## Design patterns
* Creational Patterns
** Abstract Factory
@@ -125,5 +125,3 @@ h2. Design patterns
** State
** Template Method
** Visitor
-
-

0 comments on commit 343fbde

Please sign in to comment.
Something went wrong with that request. Please try again.