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
source 'https://rubygems.org' | |
gem 'rails' | |
# etc, etc. | |
gem 'rack-cors', require: 'rack/cors' |
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
# This is what my params looks like | |
{:group_id=>86, | |
:payer_id=>1982, | |
:account_type=>"standard", | |
:sms_credit_price_ex_tax=>"0.025", | |
:auto_purchase_sms_credits_amount=>1000, | |
:setup_invoice=>true, | |
:locale=>"en-GB", | |
:timezone=>"London", |
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
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 |
OlderNewer