CoffeeScript The Smart Way
CoffeeScript The Smart Way
Learn CoffeeScript by Solving the Most Interesting Scenarios
About the Book
CoffeScript allows you to code with less lines than Javascript, it makes everything easier than Javascript, it's powerful, efficient, it's the language you need to start using from now on.
You write your code in CoffeeScript, then it gets compiled into plain Javascript and it's fully compatible with all your scripts, libraries and frameworks.
The functionality of CoffeScript is incredible, a script coded in Javascript might take you 57 lines of code, when you use CoffeScript you might code the same script in just 13 lines.
People are using CoffeeScript to make games, web development, applications, you name it !! It's easy to learn and this book takes you through a series of scenarios teaching you how to address them in CoffeSccript. (Once you see it in action you will never stop using it !!)
Check out other books from the author:
Up to Speed with Javascript in 59 minutes
Learning Python Programming from Scratch
Front End Developer Interview Questions
Bundles that include this book
Table of Contents
-
Other Books by Alejandro
- Recommended Resources
-
Introduction
- Who is this book for ?
- What this book covers ?
-
Chapter 1: Syntax Scenarios
- Code Reuse on Client and Server
- Comparing Ranges
- Embedding JavaScript
- For Loops
-
Chapter 2: Classes and Objects Scenarios
- Chaining Calls to an Object
- Class Methods and Instance Methods
- Class Variables and Instance Variables
- Cloning an Object (Deep Copy)
- Mixins for classes
- Create an Object Literal if It Does Not Already Exist
- A CoffeeScript Type Function
-
Chapter 3: Strings Scenarios
- Capitalizing Words
- Finding Substrings
- Generating a Unique ID
- String Interpolation
- Lowercasing a String
- Matching Strings
- Repeating a String
- Repeat method for Strings
- Replacing Sub-Strings Within a String
- Splitting a String
- Trimming Whitespace from a String
- Uppercasing a String
-
Chapter 4: Arrays Scenarios
- Check if type of value is an Array
- Concatenating Arrays
- Creating a dictionary Object from an Array
- Creating a String from an Array
- Define Ranges Array
- Filtering Arrays
- List Comprehensions
- Mapping Arrays
- Max Array Value
- Reducing Arrays
- Removing Duplicate Elements from Arrays
- Reversing Arrays
- Shuffling Array Elements
- Testing Every Element
- Using Arrays to Swap Variables
- where for arrays of objects
- Python-like Zip Function
-
Chapter 5: Dates and Times Scenarios
- Calculate the Date of Easter Sunday
- Calculate the Date of Thanksgiving (USA and Canada)
- Get Days Between Two Dates
- Finding the Last Day of the Month
- Finding Last (or Next) Month
- Calculate Phase of the Moon for a Date
-
Chapter 6: Math Scenarios
- Math Constants
- Faster Fibonacci Algorithm
- Fast Inverse Square Root
- Generating Predictable Random Numbers
- Generating Random Numbers
- Converting Radians and Degrees
- A Random Integer Function
- Working with Exponents and Logarithms
-
Chapter 7: Functions Scenarios
- Debounce Functions
- When Function Parentheses Are Not Optional
- Recursive Functions
- Splat Arguments
-
Chapter 8: Metaprogramming Scenarios
- Detecting and Creating Missing Functions
- Extending Built-in Objects
-
Chapter 9: jQuery Scenarios
- AJAX
- Callback Bindings # using ⇒ instead of ->
- Create a jQuery Plugin
- Ajax Request Without jQuery
- Older Browser Support
-
Chapter 10: Regular Expressions Scenarios
- Using Heregexes
- Replacing HTML Tags with HTML Named Entities
- Replacing Substrings
- Searching for Substrings
-
Chapter 11: Networking Scenarios
- Basic Client
- Basic HTTP Client
- Basic HTTP Server
- Basic Server
- Bi-Directional Client
- Bi-Directional Server
-
Chapter 12: Design Patterns Scenarios
- Adapter pattern
- Bridge Pattern
- Builder Pattern
- Command Pattern
- Decorator Pattern
- Factory Method Pattern
- Interpreter Pattern
- Memento Pattern
- Observer Pattern
- Singleton Pattern
- Strategy Pattern
- Template Method Pattern
-
Chapter 13: Databases Scenarios
- MongoDB
- SQLite
-
Chapter 14: Testing Scenarios
- Testing with Jasmine
- <span style=”color: red;”>Running the Tests</span>
- Getting the Tests to Pass
- <span style=”color: green;”>Refactoring the Tests</span>
- Testing with Nodeunit
- <span style=”color: red;”>Running the Tests</span>
- <span style=”color: green;”>Getting the Tests to Pass</span>
- <span style=”color: green;”>Refactoring the Tests</span>
- Keep developing your CoffeScript skills
- About the Author
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them