Skip to content

Instantly share code, notes, and snippets.

View kylerippey's full-sized avatar

Kyle Rippey kylerippey

  • Recurrent
  • Seattle, WA
View GitHub Profile

Keybase proof

I hereby claim:

  • I am kylerippey on github.
  • I am kylerippey (https://keybase.io/kylerippey) on keybase.
  • I have a public key ASAUZTgAbFM1zqLq-X1wc1Flg97QWjvVE1W7RTk26JmGGQo

To claim this, I am signing this object:

@kylerippey
kylerippey / pre-commit
Created March 28, 2018 00:06
Pre-commit git hook to optimize assets upon commit
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
@kylerippey
kylerippey / heredoc.rb
Last active May 3, 2017 05:48
HEREDOCs interpolating __FILE__ don't seem to work in Ruby 2.4+
# Works in Ruby 2.3 and 2.4
puts "#{__FILE__}"
# Works in Ruby 2.3 and 2.4
x = __FILE__
puts <<~HEREDOC
#{x}
HEREDOC
# Works in Ruby 2.3
@kylerippey
kylerippey / crushinator.rb
Created July 3, 2013 02:57
The Crushinator - v1.01
class Crushinator < RTanque::Bot::Brain
NAME = 'Crushinator'
include RTanque::Bot::BrainHelper
def tick!
follow
seek
destroy
@kylerippey
kylerippey / schema_performance.rb
Created May 28, 2013 16:05
Benchmark for minor_schema_migration_refactor pull request: https://github.com/rails/rails/pull/10766
require File.expand_path('../../../load_paths', __FILE__)
require "active_record"
require 'benchmark/ips'
TIME = (ENV['BENCHMARK_TIME'] || 20).to_i
RECORDS = (ENV['BENCHMARK_RECORDS'] || TIME*1000).to_i
conn = { :adapter => 'sqlite3', :database => ':memory:' }
ActiveRecord::Base.establish_connection(conn)
@kylerippey
kylerippey / crushinator
Last active December 17, 2015 14:29
The Crushinator - v1.0
class Crushinator < RTanque::Bot::Brain
NAME = 'Crushinator'
include RTanque::Bot::BrainHelper
def tick!
follow
seek
destroy