Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
CoffeeScript Programming with jQuery, Rails, and Node.js
Table of Contents
CoffeeScript Programming with jQuery, Rails, and Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Why CoffeeScript?
CoffeeScript syntax
Semicolons and braces
Whitespace
Parenthesis
CoffeeScript has great function syntax
Return isn't required
Function arguments
Where did the var keyword go?
CoffeeScript handles scope better
Top level var keywords
CoffeeScript has better object syntax
Inheritance
Overwhelmed?
Extending prototypes
A few other things CoffeeScript fixes
Reserved words and object syntax
String concatenation
Equality
The existential operator
List comprehensions
The while loop
Conditional clauses and logical aliases
Array slicing and splicing
Destructuring or pattern matching
=> and @
Switch statements
Chained comparisons
Block strings, block comments, and strings
Summary
2. Running CoffeeScript
The CoffeeScript stack
Node.js and npm
Node.js, npm, and CoffeeScript on Windows
Installing CoffeeScript on a Mac
Using the Apple installer
Using Homebrew
Installing CoffeeScript with npm
Installing CoffeeScript on Linux
Ubuntu and MintOS
Debian
Other distributions
Installing CoffeeScript with npm
Building Node.js from source
Building on Linux or Unix
Building on Windows
Using CoffeeScript
The coffee command
The REPL
Running .coffee files
Compiling to JavaScript
Watching
Putting it all together
Summary
3. CoffeeScript and jQuery
Finding and changing elements
The $ function
Utility functions
Ajax methods
Using jQuery
Using CoffeeScript and jQuery in the browser
Compiling CoffeeScript
jQuery and CoffeeScript
Testing it all
Running a local web server
Our application
TodoMVC
Our initial HTML
Initializing our app
Adding a to-do item
Using localStorage
Displaying the to-do items
Showing the to-do items
Removing and completing items
Now, it's your turn!
Summary
4. CoffeeScript and Rails
What makes Rails special?
Convention over configuration
Don't repeat yourself (DRY)
Rails and JavaScript
Rails and CoffeeScript
Installing Rails
Installing Rails using RailsInstaller
Installing Rails using RVM
Got Rails installed?
Developing our Rails application
MVC
Running our application
Our todo_items resource
routes.rb
The controller
The view
The CSS
Our model
Migrations
The Rails console
Displaying the items in our view using ERB
Creating a partial
Adding new items
Let's try and add a to-do item
Adding a CoffeeScript view
CoffeeScript in the asset pipeline
Completing the to-do items
Removing tasks
Now, it's your turn
Summary
5. CoffeeScript and Node.js
Node is event-driven
Node is fast and scalable
Node is not Rails
Node and CoffeeScript
"Hello World" in Node
Express
WebSocket
Jade
Our application
Let's get started
package.json
Installing our modules
Creating our app
Running our application
Creating a view
node-supervisor
The to-do list view
Middleware
Our stylesheet
The client side
Adding collaboration
Creating the collaboration UI
WebSocket on the client
WebSocket on the server
Joining a list
The UI
Leaving a list
Testing it all
Adding to-do items to a shared list
Removing to-do items from a shared list
Now, it's your turn
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →