Skip to content

Instantly share code, notes, and snippets.

Benjamin Humphrey humphreybc

Block or report user

Report or block humphreybc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View serve_gzip_images.rb
require 'action_dispatch/middleware/static'
ActionDispatch::FileHandler.class_eval do
def gzip_file_path(path)
return false if ['image/png', 'image/jpeg', 'image/gif'].include? content_type(path)
gzip_path = "#{path}.gz"
if File.exist?(File.join(@root, ::Rack::Utils.unescape_path(gzip_path)))
You can’t perform that action at this time.