Skip to content

Instantly share code, notes, and snippets.

View cirode's full-sized avatar

Chris Rode cirode

View GitHub Profile
#install xcode dev tools
xcode-select --install
#install homebrew install instructions at https://brew.sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
## get the Brewfile
???
# brew bundle
@cirode
cirode / gist:9666edb6ef20d0bd1e891b4bcdc26b7a
Created September 11, 2018 01:42
Disable indexes postgres
UPDATE pg_index
SET indisready=false
WHERE indrelid = (
SELECT oid
FROM pg_class
WHERE relname='<TABLE_NAME>'
);
UPDATE pg_index
SET indisready=true
@cirode
cirode / data_cleanse_maximum_stays_offers.rb
Created December 1, 2017 02:15
Hooroo: Cleansing Operation For Maximum Stays
Offer.includes(room_type: :property).where('properties.status=? and offers.default_maximum_stay=?', 'published',1).find_each do |offer|
offer.default_maximum_stay = nil
offer.rates.where('night_of >= ? and maximum_stay=?', Date.today,1).find_each do |rate|
rate.maximum_stay = nil
rate.save!
end
offer.save!
end
docker-machine ssh dev
cat SECURITY_KEY > /var/lib/boot2docker/hooroo.pem
echo "#!/bin/sh\ncat /var/lib/boot2docker/hooroo.pem >> /etc/ssl/certs/ca-certificates.crt" > /var/lib/boot2docker/bootlocal.sh
chmod +x /var/lib/boot2docker/bootlocal.sh
@cirode
cirode / uninstall_gems.sh
Created May 8, 2013 06:21
Painlessly uninstall all gems
gem list | cut -d" " -f1 | xargs gem uninstall -aIx
#http://geekystuff.net/2009/01/14/remove-all-ruby-gems/
@cirode
cirode / class_load_test.rb
Last active December 16, 2015 02:19
This show the difference between naming classes with the :: syntax or wrapping with an explicit module. Try and guess what will happen when you run the code below
module C
class B
def initialize
puts 'B'
end
end
end
module C
class D
@cirode
cirode / gist:1037763
Created June 21, 2011 12:35 — forked from clayton/gist:89659
Rcov Rake task
# From http://github.com/jaymcgavren
#
# Save this as rcov.rake in lib/tasks and use rcov:all =>
# to get accurate spec/feature coverage data
require 'cucumber/rake/task'
require 'spec/rake/spectask'
namespace :rcov do
Cucumber::Rake::Task.new(:cucumber) do |t|