Skip to content

Instantly share code, notes, and snippets.

🔌
plugged in

Andrew Shannon Brown ashanbrown

🔌
plugged in
Block or report user

Report or block ashanbrown

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 loud_int.py
from __future__ import print_function
import contextlib
import pytest
# Introduce a Loud integer class that has some annoying properties that force us into a bunch of
# set up in our tests (in this case, to prevent unnecessary output to stdout during test)
class LoudInt(int):
@ashanbrown
ashanbrown / gist:c336923ee94609528095
Created Jan 24, 2015
accepts_nested_attributes_for breaks automatic inverse_of
View gist:c336923ee94609528095
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@ashanbrown
ashanbrown / new_relic.rb
Created Dec 5, 2014
initializer monkey patch to get new_relic explains to show up when using octopus
View new_relic.rb
if defined?(NewRelic::Agent::Instrumentation::ActiveRecordSubscriber)
module NewRelic
module Agent
module Instrumentation
class ActiveRecordSubscriber
def active_record_config_for_event_with_octopus(event)
return unless event.payload[:connection_id]
config = active_record_config_for_event_without_octopus(event)
View rails_eager_load_assoication_with_joins
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'i18n', github: 'svenfuchs/i18n'
gem 'sqlite3'
GEMFILE
@ashanbrown
ashanbrown / jquery.ajax.queue.coffee
Last active Aug 29, 2015 — forked from maccman/jquery.ajax.queue.coffee
queued ajax requests with a queueMaxConcurrency option that can be set on each request
View jquery.ajax.queue.coffee
$ = jQuery
queues = {}
queue = (name) ->
name = 'default' if name is true
queues[name] or= {entries: [], running: 0}
next = (name, done) ->
list = queue(name)
@ashanbrown
ashanbrown / polymorphic_inverse_test.rb
Last active Aug 29, 2015
test case for polymorphic inverse_of
View polymorphic_inverse_test.rb
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rails', github: 'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
You can’t perform that action at this time.