Gist is a free service run by Github, the open-source project hosting service. Gist allows you to post code snippets share them via a unique URL, and even allows for comments. Just go to The Gist Website, paste in your code, give it a title and description, then click "embed" and copy the link. You can paste the link into your blog, and (using javascript) it will embed an un-mangled code snippet, just like this:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Load Prototype and script.aculo.us, then slide a div up and down. | |
*/ | |
google.load("prototype", "1"); | |
google.load("scriptaculous", "1"); | |
var up = false; | |
function slideUpDown() { | |
if (up) { | |
Effect.SlideDown('content', {'duration' : 0.2}); | |
up = false; | |
} else { | |
Effect.SlideUp('content', {'duration' : 0.2}); | |
up = true; | |
} | |
} | |
function OnLoad(){ | |
var content = $('content'); | |
content.innerHTML = '<div>The Content</div>'; | |
window.setInterval(slideUpDown, 600); | |
} | |
google.setOnLoadCallback(OnLoad); |
No comments:
Post a Comment