Skip to content

Instantly share code, notes, and snippets.

@cfurrow
Created November 24, 2010 15:51
Show Gist options
  • Save cfurrow/713851 to your computer and use it in GitHub Desktop.
Save cfurrow/713851 to your computer and use it in GitHub Desktop.
# 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
%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
<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