I like writing code, and sharing it.

Often I want to post a snippet here or on another website, to illustrate a point or to share a cool trick. But pasted code is dead code - real living code changes, and short of going back and repasting, the code on the web quickly becomes out of date.

So this is a little snippet I whipped up to dynamically (by the wonders of cross-site ajax) load code from a github branch. This means, when you update the git branch and repush, the code will update.

Here it is, bootstrapped and ready, and completely up to date.

 Code available at http://github.com/peterbraden/peterbraden.github.com/blob/1ca083ed7890f5bc0d8b5555548a853ca2e6d420/github-code.js

(Standard disclaimer applies - untested on IE, YMMV. Hack at will)

Comment on this

This is not an open forum — abusive or worthless comments will be deleted

  1. Philip Roberts

    I like that you are using your code to pull in your code. Mmm recursion.


  2. Philip Roberts

    p.s. Style your comments error/thankyou pages already :)