Skip to content

Instantly share code, notes, and snippets.

💭
Coding

Chris DiMartino cdimartino

💭
Coding
View GitHub Profile
View gist:2347a408097bf1ff70fe04bf0420baf3
mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 172.18.0.119
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 {
currentUser{
panels {
nodes {
id
title
type
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) { described_class.new(quick_test_template).to_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` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`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
cdimartino / pre-commit
Last active Mar 2, 2017
Yardoc git pre-commit hook
View pre-commit
#!/bin/sh
# 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 -
#!/bin/sh
GIT=`which git`
$GIT clone https://github.com/kaplan-advance/backoffice-simple-setup
cd backoffice-simple-setup
bundle
bundle exec rake boss
@cdimartino
cdimartino / route_id_collisions.md
Created Feb 22, 2016
Sinatra routes - avoiding capture variable naming collisions
View route_id_collisions.md

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:

Anti-Pattern

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

Anti-Anti-Pattern

@cdimartino
cdimartino / habtm.md
Created Feb 12, 2016
Has and Belongs to Many
View habtm.md

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
end

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