Skip to content

Instantly share code, notes, and snippets.

View calebwoods's full-sized avatar

Caleb Woods calebwoods

View GitHub Profile
@calebwoods
calebwoods / braintree_test_app.rb
Created December 5, 2014 23:50
Used to access external services in Rails tests
# create in config/initializers
class BraintreeTestApp
def initialize(app)
@app = app
end
def call(env)
@env = env
config = Braintree::Configuration.instantiate
@calebwoods
calebwoods / resize.rb
Last active October 24, 2017 11:41
Script for resizing a directory of images using Ruby. Note requires the RMagick gem to be installed and assumes Rbenv is used for managing the Ruby Version. Blog post: http://www.calebwoods.com/2015/02/01/batch-resizing-images-ruby/
#!/usr/bin/ruby
require 'RMagick'
require 'pathname'
@directory = Pathname(File.expand_path(ARGV[0]))
@size = ARGV.fetch(1) { 1025 }
def resize_image(file)
img = Magick::Image.read(file).first
@calebwoods
calebwoods / Gemfile
Last active February 6, 2017 21:45
Simple standalone ActiveRecord setup. Usage: [pry|irb] -r ./post.rb
source 'https://rubygems.org'
gem 'activerecord', '>= 4.2.0'
gem 'sqlite4'