Skip to content

Instantly share code, notes, and snippets.

View benjaminwood's full-sized avatar
👨‍💻
Workin'

Benjamin Wood benjaminwood

👨‍💻
Workin'
View GitHub Profile
@benjaminwood
benjaminwood / liquid_filters.rb
Created September 10, 2013 16:27
Simple Locomotive CMS image resizing/cashing using (free) proxy service http://images.weserv.nl. Drop this file in your engine's config/initializers directory, restart your rails server and use the filter like this: {{ image_path | scaled_image_url: 'widthxheight' }} Example: {{ post.image.url | scaled_image_url: '1096x616' }}
module Locomotive
module Liquid
module Filters
module Text
# Create a url that will result in the given image
# being scaled and compressed by the specified amount
#
# For more info see: http://images.weserv.nl/
#
@benjaminwood
benjaminwood / pricing.html.haml
Last active December 25, 2015 21:59
Boostrap 3, three tier pricing table (with fourth column for general details or buttons. Not completely finished, but a good starting point.
#pricing
.arrow-down
.container
.fancy-heading
%h2.heading Pricing
.center-block
.row
.col-md-3.option.tier_1
.header
%span.title Single
@benjaminwood
benjaminwood / gist:8479144
Created January 17, 2014 18:47
Rdio crash report
Process: Rdio [32512]
Path: /Applications/Rdio.app/Contents/MacOS/Rdio
Identifier: com.rdio.desktop
Version: 2.25 (2.25)
Code Type: X86 (Native)
Parent Process: launchd [396]
Responsible: Rdio [32512]
User ID: 501
Date/Time: 2014-01-17 10:45:54.737 -0800
@benjaminwood
benjaminwood / active_admin_boolean_checked.rb
Created February 14, 2014 22:47
# Active admin relies on a method "boolean_checked?" that is part of a newer version of formtastic that we cannot upgrade to because of surveyor compatibility. This is an initializer monkey patch.
module ActiveAdmin
module Inputs
class FilterBooleanInput < ::Formtastic::Inputs::BooleanInput
def boolean_checked?(value, checked_value)
case value
when TrueClass, FalseClass
value
when NilClass
false
activeadmin (0.6.3) lib/active_admin/inputs/filter_boolean_input.rb:19:in `checked?'
formtastic (2.1.1) lib/formtastic/inputs/boolean_input.rb:72:in `check_box_html'
activeadmin (0.6.3) lib/active_admin/inputs/filter_boolean_input.rb:9:in `block in to_html'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `block in capture'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:187:in `with_output_buffer'
haml (3.1.7) lib/haml/helpers/xss_mods.rb:109:in `with_output_buffer_with_haml_xss'
actionpack (3.2.13) lib/action_view/helpers/capture_helper.rb:40:in `capture'
haml (3.1.7) lib/haml/helpers/action_view_mods.rb:105:in `capture_with_haml'
activeadmin (0.6.3) lib/active_admin/inputs/filter_base.rb:11:in `input_wrapping'
activeadmin (0.6.3) lib/active_admin/inputs/filter_boolean_input.rb:7:in `to_html'
require 'action_view'
require 'ostruct'
require 'erb'
require 'flog'
require 'ruby_parser'
require 'sexp_processor'
ERBHandler = ActionView::Template::Handlers::ERB.new
def new_template(body, details={format: :html})

Keybase proof

I hereby claim:

  • I am benjaminwood on github.
  • I am benjaminwood (https://keybase.io/benjaminwood) on keybase.
  • I have a public key whose fingerprint is F5F8 A6C7 5F99 E195 189F 60B8 0205 FF8F 4B67 5D5B

To claim this, I am signing this object:

---
engines:
rubocop:
enabled: true
ratings:
paths:
- lib/**
- "**.rb"
exclude_paths:
- spec/**/*
START RequestId: 62375f65-6814-11e7-9b71-5d7513cb8861 Version: $LATEST
2017-07-13 14:44:01.472 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Spawning headless shell
2017-07-13 14:44:01.496 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda ChromeLauncher No debugging port found on port 9222, launching a new Chro
me.
2017-07-13 14:44:01.496 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Chrome already running with pid 13.
2017-07-13 14:44:01.496 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Waiting for Chrome 0
2017-07-13 14:44:02.013 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Waiting for Chrome 1
2017-07-13 14:44:02.514 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Waiting for Chrome 2
2017-07-13 14:44:03.015 (-07:00) 62375f65-6814-11e7-9b71-5d7513cb8861 @serverless-chrome/lambda Waiting fo
var logLocationInforation = [];
var logs = [];
function download(filename, text) {
var pom = document.createElement('a');
pom.setAttribute('href', URL.createObjectURL(new Blob([text], {type: "application/octet-stream"})));
pom.setAttribute('download', filename);
if (document.createEvent) {
var event = document.createEvent('MouseEvents');