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)))
View deferred-example.js
var events = [];
window.track = events.push.bind(events);
document.addEventListener("DOMContentLoaded", function() {
window.track = function(name) {
View production.rb
config.public_file_server.headers = {
'Cache-Control' => 'public, s-maxage=31536000, maxage=15552000',
'Expires' => "#{1.year.from_now.to_formatted_s(:rfc822)}"
View assets_helper.rb
module AssetsHelper
def inline_file(path)
if assets = Rails.application.assets
asset = assets.find_asset(path)
return '' unless asset
else, 'public', asset_path(path)))
View style.css
body {
font-family: font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
View pages_controller.rb
class PagesController < ApplicationController
layout 'website'
View website.html.haml
!!! XML
%html{ lang: 'en' }
= javascript_include_tag 'website', defer: 'defer'
humphreybc / free_email_providers.conf
Last active May 22, 2019
List of free email providers
View free_email_providers.conf
humphreybc / configuration.js
Last active Jun 13, 2018
Webpack 3 configuration for Dovetail
View configuration.js
// Common configuration for webpacker loaded from config/webpack/paths.yml
const { join, resolve } = require("path");
const { env } = require("process");
const { safeLoad } = require("js-yaml");
const { readFileSync } = require("fs");
const configPath = resolve("config", "webpack");
const loadersDir = join(__dirname, "loaders");
const paths = safeLoad(readFileSync(join(configPath, "paths.yml"), "utf8"))[env.NODE_ENV];
You can’t perform that action at this time.