$('pre.gist').each(function(){
var placeholder = $(this);
var filename = placeholder.data('file');
$.ajax({
url: 'https://api.github.com/gists/'+$(this).data('id'),
type: 'GET',
dataType: 'jsonp'
}).success( function(gistdata) {
if(filename != null && typeof gistdata.data.files[filename] !== "undefined"){
var content = gistdata.data.files[filename].content;
}else{
var content = gistdata.data.files[Object.keys(gistdata.data.files)[0]].content;
}
placeholder.removeClass('prettyprinted');
placeholder.text(content);
prettyPrint();
}).error( function(e) {
// ajax error
});
});