Here’s an obvious-in-retrospect bit of code:
$.fn.liveAndRun = function(event_name, f) {
$(this).live(event_name, f);
f.apply(this);
}
It’s for when you have checkboxes or radio buttons that toggle the visibility of form inputs. If validation fails and you send the form back to the browser, using $(selector).liveAndRun instead of $(selector).live means that the functions that sort out visibility happen on page load, not just when the checkbox gets clicked. And happy unicorns ride ponies to a delicious breakfast.