Skip to content

Instantly share code, notes, and snippets.

@assembler
Created March 15, 2012 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save assembler/2047145 to your computer and use it in GitHub Desktop.
Save assembler/2047145 to your computer and use it in GitHub Desktop.
Render gists on tumblr
<!-- GIST Renderer -->
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"/>
<script type="text/javascript">
var cachedWrite = document.write,
body = $('body'),
gists = $("a[href*='gist.github.com'][href$='#embed']").get(),
embedNextGist = function() {
if (gists.length == 0) {
document.write = cachedWrite;
}
else {
var gist = gists.shift(),
src = $(gist).attr('href').split('#')[0];
document.write = function(styleLink) {
document.write = function(gistDiv) {
$(gist).replaceWith(gistDiv);
embedNextGist();
};
};
body.append('<scr' + 'ipt src="' + src + '.js"></scr' + 'ipt>');
}
};
embedNextGist();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment