This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'json' | |
require 'yaml' | |
require 'rest-client' | |
require 'active_support/all' | |
require 'readline' | |
class Pullr | |
DEBUG = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assuming it's running on port 3000 | |
kill -9 `lsof -i :3000|awk 'NR > 1 {print $2}' -|uniq` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo/retry' | |
require 'mongo/retry_replica_set_connection' | |
if ENV['MONGOHQ_REPLICASET_URL'] | |
# MongoMapper.config = {RAILS_ENV => {'uri' => ENV['MONGOHQ_REPLICASET_URL']}} | |
parser = Mongo::URIParser.new(ENV['MONGOHQ_REPLICASET_URL']) #* begin | |
MongoMapper.config = { | |
RAILS_ENV => { | |
'uri' => nil, | |
'hosts' => parser.nodes, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#require 'redgreen/autotest' | |
AUTOTEST_IMAGE_PATH = File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : File.expand_path(__FILE__)) | |
module Autotest::Notify | |
def self.notify title, msg, img, urgency='low' | |
system "notify-send -c autotest -i #{img.inspect} #{title.inspect} #{msg.inspect}" | |
end | |
Autotest.add_hook :ran_command do |autotest| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION yday(time_in TIMESTAMP) RETURNS INTEGER AS $$ | |
DECLARE | |
yr INTEGER; | |
mnth INTEGER; | |
yday INTEGER; | |
BEGIN | |
-- Ensure March 1st and after always have the same day of year across leap-years | |
-- by adding 1 to the day of year for months after Feb in non-leap years | |
yday := EXTRACT(doy FROM time_in); | |
yr := EXTRACT(year FROM time_in); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe "#has_no_duplicates" do | |
before do | |
account = Fabricate :account | |
@contact = Fabricate.build :contact, account: account, locale: account.locale | |
end | |
it "should add errors if there are duplicates" do | |
@contact.stub(:duplicates).and_return [mock(Contact, details: {email_address: 'foo', mobile_number: 'bar'})] | |
@contact.send(:has_no_duplicates) | |
@contact.errors.should be_present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: App Jasmine specs | |
@javascript | |
Scenario: App Jasmine specs passing | |
Given I am on the jasmine page | |
Then I should not see the text "Failing" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@current_company ||= (current_user.accessible_companies.find_by_id(session[:current_company_id]) if session[:current_company_id]) || current_user.companies.first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def self.find_by_id_or_first(id) | |
(id && where(:id => id).first) || first | |
end | |
# or... | |
def self.find_by_id_or_first(id) | |
order("id = #{id.to_i} DESC").first | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get --force-yes install build-essential openssl libreadline6 libreadline6-dev curl \ | |
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \ | |
libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison | |
&& | |
\curl -L https://get.rvm.io | bash -s stable --autolibs=enabled | |
&& | |
OlderNewer