Butochnikov
6/20/2014 - 9:42 PM

<pre class="gist" data-id="7377194"></pre>

$('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
		});
	});