View boxen-add
#!/usr/bin/env ruby
if ARGV.empty?
abort "USAGE: boxen-add [brew|cask|mas] NAME"
end
require 'yaml'
def hiera_path
"/opt/boxen/repo/hiera/users/indirect.yaml"
View keybase.md

Keybase proof

I hereby claim:

  • I am indirect on github.
  • I am indirect (https://keybase.io/indirect) on keybase.
  • I have a public key ASC98bkADWP08Ac1-bqQE3wfG_LS1pN7dZmFktOaE6a6zAo

To claim this, I am signing this object:

View idonethis-report.rb
#!/usr/bin/env ruby
require 'date'
require 'rdoc'
include RDoc::Text
require 'bundler/inline'
gemfile do
source "https://rubygems.org"
View prep_shopify_csv.rb
#!/usr/bin/env ruby
require 'csv'
unless ARGV[0]
puts "USAGE: #{__FILE__} SHOPIFY_CSV"
end
FIELDS = ["Shipping Name", "Shipping Street", "Shipping Address1", "Shipping Address2", "Shipping Company", "Shipping City", "Shipping Zip", "Shipping Province", "Shipping Country", "Shipping Phone"]
View repo_stats.rb
#!/usr/bin/env ruby
api_token = "xxx"
org_name, repo_name = ARGV.first.split("/")
module Enumerable
def histogram(&block)
h = Hash.new(0)
each do |entry|
key = block_given? ? yield(entry) : entry
View application.adapter.js
import ActiveModelAdapter from 'active-model-adapter';
export default ActiveModelAdapter.extend();
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View rspec_retries.rb
# Works with RSpec 3.2.0
module Sometimes
def run_with_retries(example_to_run, retries)
example = RSpec.current_example
example.metadata[:retries] ||= retries
retries.times do |t|
example.metadata[:retried] = t + 1
example.instance_variable_set(:@exception, nil)
example_to_run.run
View README.md

Rails 4 Silenceable Logger

For when you really, really don't want to log a request.

I'm using this logger to skip logging requests for CarrierWave-uploaded images in development. Loading database dumps from other environments means that the images simply aren't there in development. Rather than deal with an ActiveSupport::RoutingError and a huge 20 line backtrace per missing image, I'm just suppressing all output using this logger and a catchall route that's only active in development.

Usage

Add lib/silenceable_logger.rb to your Rails app, and adapt config/development.rb and config/routes.rb as needed.