Created
November 24, 2010 15:51
-
-
Save cfurrow/713851 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# local/app.rb | |
module Nesta | |
class App | |
helpers do | |
def gist(gn,filename=nil) | |
if(!filename.nil?) | |
filename = "?file=#{filename}" | |
end | |
"<script type='text/javascript' src='https://gist.github.com/#{gn}.js#{filename}'></script>" | |
end | |
end | |
end | |
end |
This file contains hidden or 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
%p Inserting a gist script block is easy now. | |
%p You can use just the gist id (found in the url of the gist) | |
= gist(12345) #=> This will insert gist with id 12345 | |
%p | |
Or you can pass in the ID, with an optional filename if you have multiple files identified | |
in the same gist ID. | |
= gist(713851,"example.haml") #=> This would insert this gist |
This file contains hidden or 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
<script src="https://gist.github.com/713851.js?file=gistHtmlExample.html"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment