Skip to content

Instantly share code, notes, and snippets.

View cgriego's full-sized avatar

Chris Griego cgriego

  • Priceline Partner Solutions
  • Portland, Oregon Metro Area
  • 19:28 (UTC -08:00)
  • X @cgriego
View GitHub Profile
@cgriego
cgriego / keybase.md
Created September 13, 2019 18:59
keybase.md

Keybase proof

I hereby claim:

  • I am cgriego on github.
  • I am cgriego (https://keybase.io/cgriego) on keybase.
  • I have a public key ASDCPm4oHxfmKUrnEh_0SRdW2umksmdBFb2FGoTaonAUago

To claim this, I am signing this object:

@cgriego
cgriego / grind.rb
Created April 21, 2015 17:07
2008 era image optimizer script
#!/usr/bin/env ruby
# Copyright (c) 2008 Chris Griego
#
# Grinder is freely distributable under the terms of an MIT-style license.
# For details, see http://www.opensource.org/licenses/mit-license.php
require 'rubygems'
require 'mime/types'
@cgriego
cgriego / request_start_variable.patch
Created August 25, 2012 19:05 — forked from michaeldauria/request_start_variable.patch
Add a 'start_time' variable to nginx 1.2.1 to support an X-REQUEST-START header. This header is used by New Relic RPM to record queue time.
--- src/http/ngx_http_variables.c.orig 2012-06-07 12:47:34.000000000 -0400
+++ src/http/ngx_http_variables.c 2012-06-07 12:55:51.000000000 -0400
@@ -99,6 +99,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
/*
@cgriego
cgriego / gist:2649046
Created May 9, 2012 21:30
/etc/init.d/rabbitmq-server fix
--- fails/rabbitmq-server 2012-04-27 09:38:57.000000000 -0500
+++ works/rabbitmq-server 2012-05-09 16:19:30.000000000 -0500
@@ -61,9 +61,10 @@
RABBITMQ_PID_FILE=$PID_FILE start-stop-daemon --quiet \
--chuid rabbitmq --start --exec $DAEMON \
--pidfile "$RABBITMQ_PID_FILE" \
+ --background \
> "${INIT_LOG_DIR}/startup_log" \
2> "${INIT_LOG_DIR}/startup_err" \
- 0<&- &
require 'spec_helper'
describe LoginRequest do
it_should_behave_like "ActiveModel"
it { should_not be_persisted }
describe "email" do
it { should respond_to :email }
it { should respond_to :email= }
it { should_not allow_value(nil).for(:email) }
@cgriego
cgriego / evil_object.rb
Created November 30, 2011 02:52
EvilObject
class EvilObject
class << self
def const_defined?(*)
true
end
def const_get(*)
Object
end
module Bar
def initialize(*args)
puts "bar"
super
end
end
class Foo
include Bar
@cgriego
cgriego / einval.rb
Created August 16, 2011 21:08
MacBook Pro Early 2011, Lion, REE 2011.03, Mongo, forking #=> Errno::EINVAL
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require 'mongo'
@conn = Mongo::Connection.new
@db = @conn['supply_chain_development']
puts @db['properties'].find.to_a.size
source "http://rubygems.org"
gem 'i18n', '~> 0.6.0beta1'
@cgriego
cgriego / gist:949389
Created April 30, 2011 04:08
ActiveResource optimizations
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 1607637..b607ebd 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -1239,9 +1239,10 @@ module ActiveResource
@attributes[key.to_s] =
case value
when Array
- resource = find_or_create_resource_for_collection(key)
+ resource = nil