Skip to content

Instantly share code, notes, and snippets.

John Woodell woodie

Block or report user

Report or block woodie

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
woodie / error.log
Created Jun 21, 2019
nio4r 2.1.0 or earlier failing with 2.4.2p198 on macOS Mojave (10.14.5)
View error.log
$ ruby -v
ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
$ gem list nio4r
*** LOCAL GEMS ***
nio4r (2.3.1, 2.3.0, 2.2.0)
$ gem install nio4r -v '2.1.0'
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
View install_p4_on_ubuntu.bash
# Keep this associative array up-to-date based on perforce packages
declare -A releases=( ["12.04"]="precise" ["14.04"]="trusty" ["16.04"]="xenial")
os_name=`grep ^NAME= /etc/os-release | cut -c6- | tr -d '"'`
if [[ $os_name != "Ubuntu" ]] ; then
echo 'Sorry, only for Ubuntu.'
exit 1
woodie / iis_mail.rb
Last active Dec 15, 2016
Local mail delivery on Windows Server using IIS SMTP Service
View iis_mail.rb
# config/environments/production.rb
# Local mail delivery using IIS SMTP Service
require 'shim/mail_message' # fix line endings
config.action_mailer.delivery_method = :file
config.action_mailer.file_settings = { location: "#{ENV['SystemDrive']}/InetPub/MailRoot/Pickup" }
# lib/shim/mail_message.rb
# Patch Mail::Message to enforce proper line-endings for Windows IIS file-type delivery.
module Mail
class Message
View hello.ts
#!/usr/bin/env typescript
class Greeter {
name: string;
constructor(name?: string) { = name || 'Nobody';
say_hello() {
console.log("Hello " +;
woodie / usr_local_bin_typescript
Last active Dec 27, 2015
I use this wrapper to run TypeScript files on-the-fly.
View usr_local_bin_typescript
#!/usr/bin/env bash
MD5DIR=`md5 -q ${@}`/
if [ ! -d $TMPDIR$MD5DIR ]; then
if [ ! -f $TMPDIR$MD5DIR$JSFILE ] || [ ${@} -nt $TMPDIR$MD5DIR$JSFILE ]; then
tsc --outDir $TMPDIR$MD5DIR ${@}
View gist:2c86aa9d4d2b6d9be43a
class SomeStatsModel < ActiveRecord::Base
establish_connection "that_other_stats_db_#{Rails.env}".to_sym
TABLE_NAME = 'some_oddly_named_stats_table'
self.table_name = "some_default_schema.#{TABLE_NAME}"
def self.sum_select(*args)* {|s| "SUM(#{s}) AS #{s}"}.join(', '))
def self.for(account_specific_schema)
// A Queue of fixed size, using an array for storage
package cis;
public class FixedQueue {
private int added = 0;
private int removed = 0;
private int capacity;
private Object[] data;
View g_stack_spec.rb
# jruby -S rspec -fs spec/g_stack_spec.rb
require 'java'
import 'cis.GStack'
import 'cis.StackException'
describe GStack, 'once created' do
# create a GStack
before(:each) do
View set_spec.rb
# jruby -S rspec -fs spec/set_spec.rb
describe Set, 'once created' do
before(:each) do
@capacity = 6
@set =
it 'should print an empty set' do
View seat_chart_spec.rb
require 'java'
import 'cis.SeatChart'
import 'cis.ArrayOutOfBoundsException'
describe SeatChart, "once created" do
before(:each) do
@chart =
You can’t perform that action at this time.