I do not wish to enter the war between jQuery and Prototype camps – I use both depending on the needs – and sometimes the engine is dictated by the framework I am using.

Anyway – a piece of code that is extremely handy and that differs quite a bit between jQuery and Prototype – execute a handler once the DOM tree is loaded.

jQuery well known ready():

$(document).ready( function () { 
// my code here
});

Prototype version:

document.observe('dom:loaded', function(){ 
// my code here 
});

In fact, there is one cool feature of Prototype that I found extremely useful on several occasions – and that is the Ajax Periodical Updater.