Skip to content

Instantly share code, notes, and snippets.

Caleb Woods calebwoods

Block or report user

Report or block calebwoods

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
calebwoods / Gemfile
Last active Feb 6, 2017
Simple standalone ActiveRecord setup. Usage: [pry|irb] -r ./post.rb
View Gemfile
source ''
gem 'activerecord', '>= 4.2.0'
gem 'sqlite4'
calebwoods / resize.rb
Last active Oct 24, 2017
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:
View resize.rb
require 'RMagick'
require 'pathname'
@directory = Pathname(File.expand_path(ARGV[0]))
@size = ARGV.fetch(1) { 1025 }
def resize_image(file)
img =
calebwoods / braintree_test_app.rb
Created Dec 5, 2014
Used to access external services in Rails tests
View braintree_test_app.rb
# create in config/initializers
class BraintreeTestApp
def initialize(app)
@app = app
def call(env)
@env = env
config = Braintree::Configuration.instantiate

Keybase proof

I hereby claim:

  • I am calebwoods on github.
  • I am calebwoods ( on keybase.
  • I have a public key whose fingerprint is 391E 05D0 70B1 0E2B A2EA 9A34 463D 65F1 B1EF DEE1

To claim this, I am signing this object:

calebwoods / nginx.conf
Created May 10, 2014
Sample Nginx config for deployment of Angular.js app
View nginx.conf
server { listen 80;
access_log /var/log/;
error_log /var/log/;
root /var/www/apps/;
charset utf-8;
location / {
rewrite ^ https://$host$request_uri? permanent;
calebwoods / bookmarklet.js
Last active Jan 3, 2016
Bookmarklet to fill custom merge message for Github Pull Request. Format used by @RoleModel
View bookmarklet.js
javascript:(function () {
var mergeMessage = $('.merge-commit-message');
if (mergeMessage.length > 0) {
prNum = location.pathname.split('/').slice(-1)[0];
var prTitle = $('.discussion-topic-title').text();
mergeMessage.val('' + prTitle + ' [KB #NUMBER] (GH #' + prNum + ')');
calebwoods / pg_hba.conf
Created Nov 21, 2013
Ansible Postgres Setup
View pg_hba.conf
# PostgreSQL Client Authentication Configuration File
# ===================================================
# Refer to the "Client Authentication" section in the PostgreSQL
# documentation for a complete description of this file. A short
# synopsis follows.
# This file controls: which hosts are allowed to connect, how clients
# are authenticated, which PostgreSQL user names they can use, which
# databases they can access. Records take one of these forms:
calebwoods / api_context.rb
Created May 20, 2013
Testing helper methods to use with Rack::Deflater
View api_context.rb
def api_post_gziped(url, params={}, api_token = 'test_token')
gzipped_data = ActiveSupport::Gzip.compress(params.to_json)
post(url, gzipped_data, headers.merge('HTTP_AUTHORIZATION' => basic_auth_for(api_token),
'CONTENT_TYPE' => 'gzip/json'))
def decompressed_json_body
calebwoods / index.html
Created Nov 27, 2012
Draw Polygons on Google Maps
View index.html
<title>Draw Sample Polygons</title>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<div id="map" style="width: 600px; height: 600px"></div>
calebwoods / utm_zone_partial.js
Created Nov 26, 2012
Test of acreage calculation for polygons that span more than 1 UTM zone.
View utm_zone_partial.js
// Zone spanning polygon
"type": "MultiPolygon",
"coordinates": [
[-90.00575, 35.99485],
[-89.99339, 35.99485],
[-89.99339, 36.00481],
[-90.00575, 36.00481],
You can’t perform that action at this time.