From 859b5d0bdc44165b510ad09e9b6cd5712e768eed Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Tue, 22 Nov 2011 14:24:05 -0600 Subject: [PATCH 1/2] Rebasing (woot!) Signed-off-by: Diwank Singh --- coffeescript/06_applications.html | 4 ++-- coffeescript/07_the_bad_parts.html | 4 ++-- coffeescript/all.html | 10 +++++----- coffeescript/chapters/06_applications.md | 6 +++--- coffeescript/index.html | 6 ------ 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/coffeescript/06_applications.html b/coffeescript/06_applications.html index 5e25c85..8ada110 100644 --- a/coffeescript/06_applications.html +++ b/coffeescript/06_applications.html @@ -87,7 +87,7 @@

Stitch it up

express = require("express") argv = process.argv.slice(2) -package = stitch.createPackage( +pckg = stitch.createPackage( # Specify the paths you want Stitch to automatically bundle up paths: [ __dirname + "/app" ] @@ -102,7 +102,7 @@

Stitch it up

app.set "views", __dirname + "/views" app.use app.router app.use express.static(__dirname + "/public") - app.get "/application.js", package.createServer() + app.get "/application.js", pckg.createServer() port = argv[0] or process.env.PORT or 9294 console.log "Starting server on port: #{port}" diff --git a/coffeescript/07_the_bad_parts.html b/coffeescript/07_the_bad_parts.html index 15f9328..5c53088 100644 --- a/coffeescript/07_the_bad_parts.html +++ b/coffeescript/07_the_bad_parts.html @@ -85,7 +85,7 @@

Global variables

})(); -

Notice how CoffeeScript initializes variables (using var) automatically in the context their first used. Whilst it's impossible to shadow outer variables, you can still refer to and access them. You need to watch out for this, be careful that you're not reusing the name of an external variable accidentally if you're writing a deeply nested function or class. For example, here we're accidentally overwriting the package variable in a Class function:

+

Notice how CoffeeScript initializes variables (using var) automatically in the context they're first used. Whilst it's impossible to shadow outer variables, you can still refer to and access them. You need to watch out for this, be careful that you're not reusing the name of an external variable accidentally if you're writing a deeply nested function or class. For example, here we're accidentally overwriting the package variable in a Class function:

@@ -491,7 +491,7 @@

Strict mode usage

class window.Spine -

Whilst I recommend enabling strict mode, but it's worth noting that script mode doesn't enable any new features that aren't ready possible in JavaScript, and will actually slow down your code a bit by having the VM do more checks at runtime. You may want to develop with strict mode, and deploy to production without it.

+

Whilst I recommend enabling strict mode, but it's worth noting that strict mode doesn't enable any new features that aren't ready possible in JavaScript, and will actually slow down your code a bit by having the VM do more checks at runtime. You may want to develop with strict mode, and deploy to production without it.

JavaScript Lint

diff --git a/coffeescript/all.html b/coffeescript/all.html index 352701e..b07271c 100644 --- a/coffeescript/all.html +++ b/coffeescript/all.html @@ -47,7 +47,7 @@

Initial setup

One of the easiest ways to initially play around with the library is to use it right inside the browser. Navigate to http://coffeescript.org and click on the Try CoffeeScript tab. The site uses a browser version of the CoffeeScript compiler, converting any CoffeeScript typed inside the left panel to JavaScript in the right panel.

-

You can also convert JavaScript back to CoffeeScript using the js2coffee project, especially useful when migration JavaScript projects to CoffeeScript.

+

You can also convert JavaScript back to CoffeeScript using the js2coffee project, especially useful when migrating JavaScript projects to CoffeeScript.

In fact, you can use the browser-based CoffeeScript compiler yourself, by including this script in a page, marking up any CoffeeScript script tags with the correct type.

@@ -1252,7 +1252,7 @@

Stitch it up

express = require("express") argv = process.argv.slice(2) -package = stitch.createPackage( +pckg = stitch.createPackage( # Specify the paths you want Stitch to automatically bundle up paths: [ __dirname + "/app" ] @@ -1267,7 +1267,7 @@

Stitch it up

app.set "views", __dirname + "/views" app.use app.router app.use express.static(__dirname + "/public") - app.get "/application.js", package.createServer() + app.get "/application.js", pckg.createServer() port = argv[0] or process.env.PORT or 9294 console.log "Starting server on port: #{port}" @@ -1546,7 +1546,7 @@

Global variables

})(); -

Notice how CoffeeScript initializes variables (using var) automatically in the context their first used. Whilst it's impossible to shadow outer variables, you can still refer to and access them. You need to watch out for this, be careful that you're not reusing the name of an external variable accidentally if you're writing a deeply nested function or class. For example, here we're accidentally overwriting the package variable in a Class function:

+

Notice how CoffeeScript initializes variables (using var) automatically in the context they're first used. Whilst it's impossible to shadow outer variables, you can still refer to and access them. You need to watch out for this, be careful that you're not reusing the name of an external variable accidentally if you're writing a deeply nested function or class. For example, here we're accidentally overwriting the package variable in a Class function:

@@ -1952,7 +1952,7 @@

Strict mode usage

class window.Spine -

Whilst I recommend enabling strict mode, but it's worth noting that script mode doesn't enable any new features that aren't ready possible in JavaScript, and will actually slow down your code a bit by having the VM do more checks at runtime. You may want to develop with strict mode, and deploy to production without it.

+

Whilst I recommend enabling strict mode, but it's worth noting that strict mode doesn't enable any new features that aren't ready possible in JavaScript, and will actually slow down your code a bit by having the VM do more checks at runtime. You may want to develop with strict mode, and deploy to production without it.

JavaScript Lint

diff --git a/coffeescript/chapters/06_applications.md b/coffeescript/chapters/06_applications.md index e4d3387..ef71309 100644 --- a/coffeescript/chapters/06_applications.md +++ b/coffeescript/chapters/06_applications.md @@ -60,7 +60,7 @@ Now to actually boot up the Stitch server. Let's create a file called `index.cof express = require("express") argv = process.argv.slice(2) - package = stitch.createPackage( + pckg = stitch.createPackage( # Specify the paths you want Stitch to automatically bundle up paths: [ __dirname + "/app" ] @@ -75,7 +75,7 @@ Now to actually boot up the Stitch server. Let's create a file called `index.cof app.set "views", __dirname + "/views" app.use app.router app.use express.static(__dirname + "/public") - app.get "/application.js", package.createServer() + app.get "/application.js", pckg.createServer() port = argv[0] or process.env.PORT or 9294 console.log "Starting server on port: #{port}" @@ -244,4 +244,4 @@ For example, when it comes to templating, you can use [Mustache](http://mustache As for serving up application, [Hem](http://github.com/maccman/hem) is a great choice, supporting both CommonJS and NPM modules and integrating seamlessly with the CoffeeScript MVC framework [Spine](http://spinejs.com). [node-browsify](https://github.com/substack/node-browserify) is another similar project. Or if you want to go lower level with [express](http://expressjs.com/) integration, there's Trevor Burnham's [connect-assets](https://github.com/TrevorBurnham/connect-assets) -You can find a full list of CoffeeScript web framework plugins, on the [project's wiki](https://github.com/jashkenas/coffee-script/wiki/Web-framework-plugins). \ No newline at end of file +You can find a full list of CoffeeScript web framework plugins, on the [project's wiki](https://github.com/jashkenas/coffee-script/wiki/Web-framework-plugins). diff --git a/coffeescript/index.html b/coffeescript/index.html index 5ded00b..d42b7a1 100644 --- a/coffeescript/index.html +++ b/coffeescript/index.html @@ -14,12 +14,6 @@

The Little Book on CoffeeScript

-
-

An updated version of the book is now available in Paperback, PDF and Kindle versions from O'Reilly.

- - -
-
  1. Introduction
  2. From 91670d8a64d982c3fd142ded60a6524bff8d0094 Mon Sep 17 00:00:00 2001 From: Diwank Singh Date: Wed, 29 Aug 2012 17:45:26 +0530 Subject: [PATCH 2/2] Fixed typo in Rakefile. Signed-off-by: Diwank Singh --- coffeescript/Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coffeescript/Rakefile b/coffeescript/Rakefile index 91defce..0906245 100644 --- a/coffeescript/Rakefile +++ b/coffeescript/Rakefile @@ -6,7 +6,7 @@ require "fileutils" def generate(page, template = "site/page.ms") Mustache.render( File.read(template), - page.merge(:content => RDiscount.new(File.read(page[:src])).to_html), + page.merge(:content => RDiscount.new(File.read(page[:src])).to_html) ) end @@ -41,4 +41,4 @@ task :generate do end end -task :default => :generate \ No newline at end of file +task :default => :generate