JavaScript

CoffeeScript Basics

CoffeeScript is an evolution of JavaScript. It actually compiles down to optimized JavaScript. It feels a lot like Python because of the significant whitespace, and lack of semi-colon line endings and curly braces. The syntax is a lot sparser than JavaScript which lends to its readability and simplicity. CoffeeScript can be run as an interpreter or a compiler. You can write plugins for the GitHub Atom Editor using CoffeeScript. The compiled JavaScript can be used for a web application or for command line applications run by Node.js.

AJAX Pagination and Sorting with CakePHP 2.x

CakePHP comes with a core JsHelper that allows a developer to call PHP functions that will create the JavaScript using a number of libraries including jQuery and Prototype. Pagination in CakePHP is a very common task and it can be enhanced using AJAX. Fortunately the Pagination component/helper are built to handle the AJAX. You can set the pagination defaults in the controller with the code below. Alternatively you could set specific elements of the array inside an action with a call like $paginate['conditions'] = array();

AJAX Form Submit with CakePHP 2.x

CakePHP has some great tools for a PHP developer to crank out JavaScript functions using only PHP. The JsHelper supports Prototype/Scriptaculous, Mootools/Mootools-more, and jQuery/jQuery UI. Refer to the CakePHP Book for details on all the functions provided by the JsHelper. In this example we're going to look at a creating a contact form that submits via AJAX, but also works properly for users without JavaScript.

Twitter Bootstrap Review

Twitter Bootstrap, which was renamed to simply Bootstrap, is am amazing tool for web developers. It is now my favorite way to get a new site going. As a developer, I feel it is powerful and flexible, but not bloated. It is just the right tools for almost any project. Check out their official website here. It comes in a very light and simple package that includes:

JavaScript source code highlighter - Prettify

Google Code Prettify is great for turning <code> tags into nicely formatted HTML. I personally appreciate how it displays the line numbers, but they don't get included when you copy+paste. There are many themes available but my favorite is the google code. It treats word wrapping well with line numbers, shows each line number, and is styled nicely. The Drupal module allows you to integrate it easily to Drupal.

Drupal Pretiffy module: http://drupal.org/project/prettify