Created
November 23, 2010 20:23
-
-
Save cfurrow/712457 to your computer and use it in GitHub Desktop.
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
# ... snipped | |
Nesta::Plugins.load_local_plugins #=> Should load gist_helper.rb, below | |
module Nesta | |
class App < Sinatra::Base | |
register Sinatra::Cache | |
set :root, File.dirname(__FILE__) | |
set :cache_enabled, Config.cache | |
helpers Sinatra::GistHelper #=> Required, according to http://www.sinatrarb.com/extensions.html | |
# ... snipped |
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
date: 2010/11/23 3:25pm | |
%h1 Some Article | |
= gist(12345) #=> Should return a <script> block, for the gist with id 12345 |
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
# file is in /plugins/gist_helper/lib/gist_helper.rb | |
require 'sinatra/base' | |
module Sinatra | |
module GistHelper | |
def gist(gn) | |
"<script type='text/javascript' src='https://gist.github.com/#{gn}.js'></script>" | |
end | |
end | |
helpers GistHelper | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment