Skip to content

Instantly share code, notes, and snippets.

@kawahara
Created September 18, 2009 17:44
Show Gist options
  • Save kawahara/189186 to your computer and use it in GitHub Desktop.
Save kawahara/189186 to your computer and use it in GitHub Desktop.
function url2cmd(url) {
if (!url.match(/^http:\/\/gist\.github\.com\/([0-9]+)/)) {
pne_url2a(url);
return;
}
var id = RegExp.$1;
main(id);
}
function main(id) {
if (!id.match(/^[0-9]+$/)) {
return;
}
var html = '<script src="http://gist.github.com/'
+ id
+ '.js"></script>';
document.write(html);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment