Created
July 28, 2012 19:13
-
-
Save gonzedge/3194459 to your computer and use it in GitHub Desktop.
Pygmentizing your Rails app hosted on Heroku
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
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 |
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
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) |
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
= highlight_code "gem 'rambling-trie'", :ruby |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment