Munen Alain M. Lafon has a nice post on using an Org capture template to record a bit of source code. I like it because it’s completely self-contained. You just define the template and it works.
The real value of his template may be the ideas it demonstrates. He shows how to capture tags for the entry as well as the language the code is for. It uses the same ideas as Michael Alan Dorman’s commnet to my post from last week.
On the other hand, if you have a use case for capturing and saving bits of code for later use, you’ll probably find Lafon’s post useful on its own terms. It’s a short post and worth taking a look at even if you aren’t interested in capturing code snippets.