Skip to content

Instantly share code, notes, and snippets.

View bradrobertson's full-sized avatar

Brad Robertson bradrobertson

  • Toronto, ON, Canada
View GitHub Profile
bradrobertson / identified.rb
Created January 3, 2019 19:22
An ID Reservation component
module IdentificationComponent
module Messages
module Events
class Identified
include Messaging::Message
attribute :source_id, String
attribute :common_id, String
bradrobertson / nginx.json
Created October 14, 2016 13:32
DCOS Nginx Service config
"id": "/nginx",
"container": {
"type": "DOCKER",
"docker": {
"image": "nginx",
"network": "BRIDGE",
"portMappings": [
"hostPort": 0,
bradrobertson / gist:6177412
Last active December 20, 2015 18:39
jquery live example
# /app/views/contacts/index.html.erb
<div class="contacts">
<div class="contact" id="contact_1">
<p class='name'>Cool Dude 1</p>
<div class="details">...</div>
<div class="contact" id="contact_2">
<p class='name'>Cool Dude 2</p>
<div class="details">...</div>
bradrobertson / spec_helper.rb
Created May 8, 2013 16:09
sample spec_helper.rb
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.clean_with :truncation
DatabaseCleaner.strategy = :transaction
seed_db_with_lots_of_data # for example
config.before(:each) do
bradrobertson / gist:5383307
Created April 14, 2013 16:26
IdentityCache with Apartment Excluded Models
# Broken Example
class Company < ActiveRecord::Base
include IdentityCache
cache_index :subdomain
Company.table_name = 'public.companies'
# => SELECT id FROM companies WHERE subdomain = 'app' LIMIT 1
bradrobertson / modal-responsive.css
Created September 6, 2012 11:44
Bootstrap Responsive Modal
// Responsive shizzle
@media (max-width: 767px) {
// Modals
.modal {
position: absolute;
top: 20px;
left: 20px;
right: 20px;
width: auto;
bradrobertson / gist:2881420
Created June 6, 2012 11:41
Failed qt installation
bradrobertson / Procfile
Created February 6, 2012 16:01
Less than ideal solution for launching different apps from one codebase on Heroku
web: bundle exec $APP
bradrobertson / gist:1168082
Created August 24, 2011 13:40
jQuerytools build error
minifying v1.2.0:src/tooltip/tooltip.slide.js
minifying v1.2.0:src/tooltip/tooltip.js
minifying v1.2.0:src/tooltip/tooltip.dynamic.js
minifying v1.2.0:src/toolbox/toolbox.mousewheel.js
minifying v1.2.0:src/toolbox/toolbox.history.js
minifying v1.2.0:src/toolbox/toolbox.flashembed.js
bradrobertson / challenge.rb
Created August 19, 2011 01:10
Find by sql in ActiveRecord
def self.open_for_participant(contact_id, group_id = nil)
SELECT challenges.* FROM challenges
LEFT OUTER JOIN challenge_participants ON challenge_participants.challenge_id =
AND challenge_participants.contact_id = #{contact_id}
SELECT 1 FROM group_challenges
JOIN group_contacts ON group_challenges.group_id = group_contacts.group_id
#{"JOIN groups on group_challenges.group_id =" if group_id}