Skip to content

Instantly share code, notes, and snippets.


Brad Robertson bradrobertson

  • Toronto, ON, Canada
View GitHub Profile
bradrobertson / database.yml
Created Nov 23, 2010
this works for trinidad server but not with migrations (stack trace below)
View database.yml
adapter: jdbc
jndi: java:/comp/env/jdbc/VeloUl
database: velo_ultralite_development
username: root
timeout: 5000
# When running rake db:migrate, I get the following:
bradrobertson / database.yml
Created Nov 23, 2010
This works for server and migrations, but now duplicates my trinidad.yml config
View database.yml
adapter: jdbc
driver: com.mysql.jdbc.Driver
jndi: java:/comp/env/jdbc/VeloUl
url: jdbc:mysql://localhost:3306/velo_ultralite_development
username: root
timeout: 5000
bradrobertson / challenge.rb
Created Aug 19, 2011
Find by sql in ActiveRecord
View challenge.rb
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}
bradrobertson / gist:1168082
Created Aug 24, 2011
jQuerytools build error
View gist:1168082
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 / Procfile
Created Feb 6, 2012
Less than ideal solution for launching different apps from one codebase on Heroku
View Procfile
web: bundle exec $APP
bradrobertson / gist:2881420
Created Jun 6, 2012
Failed qt installation
View gist:2881420
bradrobertson / modal-responsive.css
Created Sep 6, 2012
Bootstrap Responsive Modal
View modal-responsive.css
// Responsive shizzle
@media (max-width: 767px) {
// Modals
.modal {
position: absolute;
top: 20px;
left: 20px;
right: 20px;
width: auto;
bradrobertson / gist:5383307
Created Apr 14, 2013
IdentityCache with Apartment Excluded Models
View gist:5383307
# 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
View 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:6177412
Last active Dec 20, 2015
jquery live example
View gist:6177412
# /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>