Drupal guide for developers

It's still very short, but a few months ago I started a Drupal guide: Drupal 7 guide for Professional Developers.

Although it's a very personal, biased document, it's also a wiki that anyone can edit and improve.

Drupal - Adding JavaScript and CSS to every page without using hook_init()

The problem of adding css or javascript inside a hook_init() implementation, is that the hook is called during _drupal_bootstrap_full(), and will run in cases where we are not delivering HTML (such as AJAX requests). Even if this does not have any visible effect, as the html is never outputted in these requests, it unnecessarily penalises them.

JavaScript type checks

Looking for the difference between typeof variable === 'function' and jQuery.isFunction() I found this useful table for checking JavaScript types:

Optimizing media for the web: PNG images

PNG images, like other media formats, can be compressed in two different ways: Lossy and Lossless.

jQuery.cookie in Drupal 7

Apparently it's not documented, but Drupal core includes the jQuery.cookie library.