Skip to content

Instantly share code, notes, and snippets.

View agraves's full-sized avatar

Aaron Graves agraves

  • New York, NY
View GitHub Profile
"first_name": "Emma",
"last_name": "Johnson",
"full_name": "Emma Johnson",
"email": "",
"encrypted_password": "a8a3db3d3c0a2a2",
"reset_password_token": "t9a0e4f8a4e4",
"confirm_token": "d8b8c7c6f5e4d3c",
"age": 28,
# implicit
class ErrorReporter
def active?
Rails.environment.stub :production?, true do
agraves / gist:669c78761d5534c867ad
Last active August 29, 2015 14:04
Opened a can of whoop ass
Had a dream last night, uncle greg was being attacked by the wire fence behind gramp's
house in the dark by two fierce raccoons. Clung around his upper body, they were bitting
him repeatedly around hischest and head. Suddenly, in rushes three year old Aaron, like
little Yoda...he stealthy climbs up greg's body and sits up behind his head, reaching down,
he grabs each raccoon's head and quickly breaks their necks..the scene quickly falls away....
but you were left on the other side of the fence, I screamed, Come on, Aaron!! You can make it!!!"
You easily maneuver up the fence to the other side and I thought..."I guess a trip to the
hospital and two rabid shots are in order." Crazy dream...but I was wicked proud of you.
agraves / instructions
Last active August 29, 2015 14:04
Remove expired digicert certs
Instructions for clearing expired DigiCert SSL certificate on OSX
NOTICE: The following instructions "worked for me." Proceed at your own risk.
* Visiting several sites, such as github, gravatar, twitter's CDN results in "invalid certificate" errors
* For example:
agraves / gist:8605608
Created January 24, 2014 20:24
Tea starter kit
Tea Strainer - 9$ -
Black Tea - 6.25$/4oz -
Green Tea - 12$/4oz -
Brew the Green for ~2 minutes in less than boiling water, no milk, maybe a little sugar. As for the black tea, 4 minutes, boiling water, milk & sugar.
agraves / gist:5086657
Last active December 14, 2015 12:28
ruby '1.9.3'
def local_group(*g, &block)
on_heroku = (ENV['HOME'].gsub('/','') == 'app')
if on_heroku
group(:test, &block)
group(*g, &block)
agraves / gist:4772621
Created February 12, 2013 19:30
Trying to write platform-independent case-insensitive email search (without wildcards). Is this really the best way to do this?
email = ''.gsub('%', '')
users = User.arel_table
where(users[:email].matches email).
agraves / user_search.rb
Created February 11, 2013 03:05
UserSearch refactor
class UserSearch
def, topic_id = nil)
scope = User.scoped
if topic_id
scope = scope.joins("
SELECT DISTINCT(posts.user_id)
FROM posts
WHERE topic_id = #{topic_id.to_i}
1.9.3p327 :048 > t =
=> #<User id: nil, name: nil, some_bool: nil, created_at: nil, updated_at: nil>
1.9.3p327 :049 > t.some_bool = 'a string'
=> "a string"
1.9.3p327 :050 > t.some_bool
=> false
class ImplementMongo < ActiveRecord::Migration
def change
create_table :mongo do |t|
t.string :key
t.text :value