Skip to content

Instantly share code, notes, and snippets.

James Coleman jcoleman

Block or report user

Report or block jcoleman

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 Gemfile
gem "pg_query", :git => "", :ref => "f870ce136ea15a33cf9e2aabf7e8b20607061d8a"
View wargames.sql
with recursive
deck_cards as (
select face_values.card, suits.i as suit
from generate_series(1, 13) as face_values(card)
cross join generate_series(1, 4) as suits(i)
order by random()
deck_cards_with_player_indices as (
select (row_number() over ()) % 2 as player_index, deck_cards,card
from deck_cards
View puma-init.erb
#! /bin/sh
# Provides: pumacontrol
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Puma web server
View Example.m
- (void) setExpirationTextField:(UITextField*)expirationTextField {
_expirationTextField = expirationTextField;
- (void) setCardNumberTextField:(UITextField*)cardNumberTextField {
_cardNumberTextField = cardNumberTextField;
View gist:5569537
# These instructions were tested on Ubuntu 12.04 64bit
# Be prepared to wait a while...
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev libxext-dev libpq-dev libx11-dev
git clone git://
git clone git://
cd wkhtmltopdf
mkdir static-build
ln -s ../wkhtmltopdf-qt static-build/qt
jcoleman / gist:5052148
Created Feb 27, 2013
Ruby 1.9.3p392 compilation error (Clang, Mac OS 10.8)
View gist:5052148
[2013-02-27 16:49:27] make
CC = clang
LD = ld
LDSHARED = clang -dynamiclib
CFLAGS = -O3 -ggdb -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -fno-common -pipe
XCFLAGS = -include ruby/config.h -include ruby/missing.h -fvisibility=hidden -DRUBY_EXPORT
CPPFLAGS = -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libxml2/include -I/usr/local/opt/libxslt/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I. -I.ext/include/x86_64-darwin12.2.1 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace -install_name /Users/jcoleman/.rvm/rubies/ruby-1.9.3-p392-nclang/lib/libruby.1.9.1.dylib -current_version 1.9.1 -compatibility_version 1.9.1
jcoleman / coalescing_priority_queue.rb
Created Sep 27, 2012
Naïve implementation of a coalescing priority queue.
View coalescing_priority_queue.rb
require 'algorithms'
# Hybrid data structure: A priority queue in which each value pushed
# also contains an indentifying key. If a new value with that same key
# is pushed before the previous one is popped, then only the one with
# the higher priority will actually be available. The implementation
# also guarantees that should multiple values with the same key and
# the same priority be pushed, the queue with will function in a
# last-in-first-out manner.
jcoleman / PCPropertyObserver.h
Last active Oct 9, 2015 — forked from pnc/PCPropertyObserver.c
View PCPropertyObserver.h
// © 2011-2014 Phillip N. Calvin, James Coleman
// For use in a setter.
// Signs up self to receive KVO notifications about given properties
// on any new value and removes self as an observer from the old value.
// For example, to observe properties of a property called customer
// (backed by ivar _customer):
// PCPropertyObserver(customer, @"allowSubscriptionPurchase", @"availableProducts");
// You'd need to write this selector yourself:
View Faster-retrieval-of-bills-of-lading-on-consolidation-.patch
From c1358ec83a89819416f0a68a674cc06c325e8e81 Mon Sep 17 00:00:00 2001
From: James Coleman <>
Date: Thu, 2 Jun 2011 10:22:37 -0400
Subject: [PATCH] Faster retrieval of bills of lading on consolidation.
.../tms/controllers/ShipmentController.groovy | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/grails-app/controllers/com/m33integrated/tms/controllers/ShipmentController.groovy b/grails-app/controllers/com/m33integrated/tms/controllers/ShipmentController.groovy
View delegate_proc.rb
# The idea here is to emulate Groovy's delegate= pattern for closures.
# We define a builder module. This will receive method calls
# from our builder. It could be an instance of an object if we wanted.
module FamilyBuilder
def self.parent(name)
puts "Parent: #{name}"
def self.child(name)
You can’t perform that action at this time.