Skip to content

Instantly share code, notes, and snippets.

@gonzedge
Created July 28, 2012 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gonzedge/3194459 to your computer and use it in GitHub Desktop.
Save gonzedge/3194459 to your computer and use it in GitHub Desktop.
Pygmentizing your Rails app hosted on Heroku
module ApplicationHelper
PYGMENTIZE_URL = URI.parse 'http://pygmentize.herokuapp.com/'
def highlight_code(code, language)
sha = Digest::SHA1.hexdigest code
Rails.cache.fetch ['code', language, sha].join('-') do
Net::HTTP.post_form(PYGMENTIZE_URL, lang: language, code: code).body.html_safe
end
end
end
Running: rake assets:precompile
rake aborted!
Could not open library '/usr/local/lib/libpython2.7.a': /usr/local/lib/libpython2.7.a: invalid ELF header
(in /tmp/build_12k2jikx5kgsi/app/assets/stylesheets/pygments.css.scss.erb)
Tasks: TOP => assets:precompile:primary
(See full trace by running task with --trace)
= highlight_code "gem 'rambling-trie'", :ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment