Skip to content

Instantly share code, notes, and snippets.

@cfurrow
Created November 23, 2010 20:23
Show Gist options
  • Save cfurrow/712457 to your computer and use it in GitHub Desktop.
Save cfurrow/712457 to your computer and use it in GitHub Desktop.
# ... 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
date: 2010/11/23 3:25pm
%h1 Some Article
= gist(12345) #=> Should return a <script> block, for the gist with id 12345
# 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