background preloader

Coding

Facebook Twitter

CoffeeScript. Interactive Smooth CoffeeScript. The-Little-Book-on-Coffee-Script.pdf (application/pdf Object) Tutorials and snippets to get started with CoffeeScript. What is CoffeeScript? To keep it simple, CoffeeScript is a little language that compiles into JavaScript. If you ever coded in languages such as Python or Ruby, you’ll probably love CoffeeScript a lot. Instead of awkward braces and semicolons, JavaScript has always had a gorgeous object model at its heart. The code compiles one-to-one into the equivalent JS, and there is no interpretation at runtime. You can use any existing JavaScript library seamlessly from CoffeeScript (and vice-versa). Installing CoffeeScript Installing CoffeeScript is not hard at all.

Once done, you can install CoffeeScript by running the following command: npm install -g coffee-script CoffeeScript is now installed. Coffee --compile example.coffee CoffeeScript.org is the official website of the CoffeeScript language. Tutorial: Basics of CoffeeScript A great tutorial that demonstrate all you need to get started with CoffeeScript: installation, configuration and first lines of codes.→ View tutorial. 10 CoffeeScript One Liners to Impress Your Friends | ricardo.cc. You may have read "10 Scala One Liners to Impress Your Friends" at Marcus Kazmierczak's blog recently featured on HN.

Although I don't know Scala (or Java), it all looks quite nice, so I decided to impress my friends too - folks go from Java to Scala, we go from Javascript to CoffeeScript. Assume node.js as the environment for all examples. 1. Multiply each item in a list by 2 Marcus starts by showing off the map function. But we can also write the more expressive form 2. Javascript (and CoffeeScript by extension) also has native map and reduce functions: [1..1000].reduce (t, s) -> t + s (reduce == reduceLeft, reduceRight is also available) 3. Too easy since we have the some method. WordList = ["coffeescript", "eko", "play framework", "and stuff", "falsy"]tweet = "This is an example tweet talking about javascript and stuff.

" wordList.some (word) -> ~tweet.indexOf word This will return the matched words instead: wordList.filter (word) -> ~tweet.indexOf word 4. 5. But it get's better. 6. 7. 8. Features - Sugar. Arrays Sugar begins by fixing broken support for standard Javascript 1.6 array methods, such as indexOf, forEach, reduce, etc. These methods are also enhanced to accept arguments that browser native methods won't, such as nested objects, iterating functions, regexes, or strings that provide a shortcut to an iterating function. In such cases, however, browser native methods will always be defered to when possible. Many other methods help make working with arrays easier. More about arrays | Full list of methods.

Strings Sugar provides methods on strings like from, to, first, last, add, and remove to make modifying strings intuitive and readable, as well as others like each, chars, words, lines, paragraphs which allow iterating over chunks of text. Numbers Basic methods on the Math object exist in Sugar on numbers as shortcut methods. Dates Objects Although Sugar does not interfere with the Object prototype directly, it does provide many shortcuts accessed as Object class methods. Functions. For the Single Founder Who Can’t Code. Editor’s note: This is a guest post by Mick Hagen (@mickhagen), founder and CEO of Undrip. He was previously the founder of Zinch which was acquired by Chegg last year. He made headlines in the Fall with his rap campaign – an unorthodox approach to fundraising. You can learn more about him at MickHagen.com. Last summer when I started working on Undrip, I was in a tough spot. I grew up doing web and graphic design so I was a pretty good front-end developer and designer.

But I knew nothing about back-end web development – loops, branches dictionaries or functions were all foreign concepts to me. I was a single founder who couldn’t code. Against the Odds Every week I get emails from entrepreneurs seeking my advice asking how I did it before, and how I’m doing it now. If you’re a single founder who can’t code, your chances for startup success are near zero.

And a chance is all you need. Inspire or Die There’s only one skill in the world that can make up for your lack of design or dev skills. Ruby on Rails Tutorial: Learn Rails by Example book and screencasts by Michael Hartl. Michael Hartl Contents Foreword My former company (CD Baby) was one of the first to loudly switch to Ruby on Rails, and then even more loudly switch back to PHP (Google me to read about the drama).

This book by Michael Hartl came so highly recommended that I had to try it, and the Ruby on Rails Tutorial is what I used to switch back to Rails again. Though I’ve worked my way through many Rails books, this is the one that finally made me “get” it. The linear narrative is such a great format. Enjoy! Derek Sivers (sivers.org) Founder, CD Baby Acknowledgments The Ruby on Rails Tutorial owes a lot to my previous Rails book, RailsSpace, and hence to my coauthor Aurelius Prochazka. I’d like to acknowledge a long list of Rubyists who have taught and inspired me over the years: David Heinemeier Hansson, Yehuda Katz, Carl Lerche, Jeremy Kemper, Xavier Noria, Ryan Bates, Geoffrey Grosenbach, Peter Cooper, Matt Aimonetti, Gregg Pollack, Wayne E. About the author Copyright and license 1.1 Introduction. Ruby on Rails Guides. Ruby on Rails Screencasts.

Rails Cookbook. Dive Into Python. Think Python: How to Think Like a Computer Scientist. How to Think Like a Computer Scientist by Allen B. Downey This is the first edition of Think Python. It uses Python 2, with notes on differences in Python 3. If you are using Python 3, you might want to switch to the second edition. Buy this book at Amazon.com Download Think Python in PDF. Read Think Python in HTML. Example programs and solutions to some problems are here (links to specific examples are in the book). Description Think Python is an introduction to Python programming for beginners.

Some examples and exercises are based on Swampy, a Python package written by the author to demonstrate aspects of software design, and to give readers a chance to experiment with simple graphics and animation. Think Python is a Free Book. If you have comments, corrections or suggestions, please send me email at feedback{at}thinkpython{dot}com. Other Free Books by Allen Downey are available from Green Tea Press. Download Precompiled copies of the book are available in PDF. Python 3.0 Michael Kart at St. Electrical Engineering and Computer Science | 6.00 Introduction to Computer Science and Programming, Fall 2008.