Thursday, 23 July 2009

Thai Curry

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 bar none the most important ingredient in the curry. If you buy it in a pretty little glass pot with English text on it, it's going to be crap - trust me on this. What you need is a relatively large plastic tub containing a sealed bag of paste - the tub will have a label covered in Thai characters and may have a ropey English translation if you're lucky. That's the one to buy.

So, here's the basics.

Put a couple of large teaspoons of the paste into a glass bowl with some vegetable or groundnut oil. Mix it all together until you have a smooth consistency.

Shred some chicken and put it into the bowl, then mix it around until the meat is well covered with the paste-oil mix. Leave it for as long as you can. Overnight in the fridge is best, but five minutes is enough at a push.

When you are ready to cook, chop some bamboo shoots into thin strips (or buy a tin with them already stripped and then drain them). Peel and slice around an inch of galangal root into very thin strips, approximately a quarter of the thickness of the bamboo shoots.

Heat some oil in a wok until smoking, then put in the chicken that has been coated in the paste. When it's browned, add the galangal and bamboo shoots and continue to fry for a couple of minutes.

Set the wok aside and pour a tin of coconut milk into a large saucepan. Put this on a low heat on the stove, then transfer the contents of the wok into the saucepan. Add another couple of teaspoon-sized dollops of palm sugar and another couple of curry paste into the mix, stirring it into the coconut milk. Put a lid on the pan and allow it to simmer.

In the meantime, put a little more oil into the wok and quickly stir-fry some baby corn. After it is browned, pour in a handful of frozen petits pois and keep frying until they are heated through. Keep the corn and peas aside for the time being.

When you are ready to eat, add the corn and peas to the saucepan, along with a teaspoon or two of fish sauce and some creamed coconut.

Stir it all through and serve with steamed or coconut rice.

Wednesday, 1 July 2009

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:
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!
The very nice thing about this is that it can be used anywhere that jQuery offers a callback, simply by wrapping the callback function in $.scope(callback, this).

For now, problem solved.