Posts

Showing posts from July, 2009

Thai Curry

Image
This particular blog is for Onimua, who asked me over Twitter how easy this kind of dish is to create. You must excuse the quality of the photography in this entry - with the exception of the image above, I just took snapshots with my iPhone, the camera on which is pants . The answer to Onimua's question is, 'very' - if you have the right ingredients. To start, you will need: Thai curry paste Coconut milk Creamed coconut Palm sugar Thai fish sauce Bamboo shoots Petits pois For the particular variant I am describing here, you will also need: Fresh galangal Baby corn ... and your curry paste will need to be yellow. There are five different kinds of Thai curry paste readily available in asian supermarkets and the occasional western supermarket. They are Red, Green, Yellow, Masman and Panang. Each have their own characteristics, between fiery hot (green) and gorgeously aromatic (masman). In this particualar instance, I'm using yellow curry paste. The curry paste you use is...

Workaround for jQuery's lack of scope management in event / AJAX handlers

Yesterday, I wrote about the importance of the ability to have event callback functions reference this as the containing object of the method in which the event listener was created, and noted that with version 1.3.2, jQuery does not support this functionality. I also found that the latest version of jQuery (straight from SVN) supports scope assignment through the .bind() function. This seemed great, until I realised that it's necessary to have similar functionality for AJAX handlers too, and jQuery still lacks this. Therefore, after some fiddling around, the following workaround was devised: jQuery.extend({ scope: function(fn, scope) { return function() { return fn.apply(scope, arguments); } } }); Which allows us to do the following... myClass.prototype.addHandler = function(element) { $(element).click($.scope(this.handleClick, this)); } myClass.prototype.handleClick = function() { // this refers to the myClass object, yay! this.doStuff(); } The very nice thing ab...