Skip to content

Instantly share code, notes, and snippets.


Chris DiMartino cdimartino

View GitHub Profile
View gist:2347a408097bf1ff70fe04bf0420baf3
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_User: rdsrepladmin
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin-changelog.182568
Read_Master_Log_Pos: 42797165
View gist:7ca3d166f195f1221c02732812f8a27f
## Fetch Panels (with presigned url for read)
query {
panels {
nodes {
brandingAsset {
View quick_test_template_representer_v1_spec.rb
# frozen_string_literal: true
describe Smart::Representers::QuickTests::QuickTestTemplateRepresenterV1 do
let(:user) { create(:user) }
let(:study) { create(:study, :quick_test, last_updated_by: user) }
let(:quick_test_template) { create(:quick_test_template, :mobile_usability, study_template: study) }
let(:quick_test_form_item) { create(:quick_test_form_item, :url, quick_test_template: quick_test_template) }
let(:json) { }
around(:each) do |example|
View gist:10d5f7e8321db26cdcd03f8afe0180d2
Resolving dependencies...........
Bundler could not find compatible versions for gem "activesupport":
In Gemfile:
shoulda-matchers (~> 4.1.2) was resolved to 4.1.2, which depends on
activesupport (>= 4.2.0)
neo4j (~> 9.4.0) was resolved to 9.4.0, which depends on
activesupport (>= 4.0)
bullet was resolved to 5.7.5, which depends on
View gist:40d887108ad8df8cdfcecabcd62dcc21
CREATE TABLE `demographic_groups` (
`gender` int(11) NOT NULL DEFAULT '0',
`country` int(11) NOT NULL DEFAULT '0',
`expertise` int(11) NOT NULL DEFAULT '0',
`operating_system` int(11) NOT NULL DEFAULT '0',
`gaming_genre` int(11) NOT NULL DEFAULT '0',
`social_network` int(11) NOT NULL DEFAULT '0',
`web_browser` int(11) NOT NULL DEFAULT '0',
`min_income` int(11) DEFAULT NULL,
View gist:d1e4a7483f7fb8048df9d2c8eecd1b75
Panel 6: ✅ would move to workspace 124647 (General)
Panel 16: ✅ would move to workspace 85474 (General)
Panel 26: ✅ would move to workspace 96694 (General)
Panel 31: ✅ would move to workspace 154272 (General)
Panel 36: ✅ would move to workspace 85474 (General)
Panel 46: ✅ would move to workspace 106524 (General)
Panel 51: ✅ would move to workspace 106524 (General)
Panel 71: ✅ would move to workspace 85474 (General)
Panel 76: ✅ would move to workspace 85474 (General)
Panel 91: ✅ would move to workspace 96694 (General)
cdimartino / pre-commit
Last active Mar 2, 2017
Yardoc git pre-commit hook
View pre-commit
# Regenerates documentaion and adds it to the commit
# This file must live in .git/hooks/pre-commit and be executable
# Setup:
# cp pre-commit .git/hooks/
# chmod +x .git/hooks/pre-commit
View -
GIT=`which git`
$GIT clone
cd backoffice-simple-setup
bundle exec rake boss
cdimartino /
Created Feb 22, 2016
Sinatra routes - avoiding capture variable naming collisions

You MUST name your capture variables uniquely in your routes. The convention is that the object farthest to the right is the primary object being acted upon. Thus the implicit :id belongs to it, and all other :id type fields must be explicitly named:


post '/posts/:id/comments/:id/upvote' do


cdimartino /
Created Feb 12, 2016
Has and Belongs to Many

has_and_belongs_to_many and :through do not go together. Your Entry has_and_belongs_to_many :tags:

class Entry < ActiveRecord::Base
  has_and_belongs_to_many :tags

class Tag < ActiveRecord::Base
  has_and_belongs_to_many :entries
You can’t perform that action at this time.