This file contains hidden or 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 "bundler" | |
Bundler.setup | |
require "httparty" | |
unless ENV["BUILDKITE_KEY"] | |
puts "you need to set your BUILDKITE_KEY" | |
exit 1 |
This file contains hidden or 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 "bundler" | |
Bundler.setup | |
require "httparty" | |
require "byebug" | |
unless ENV["BUILDKITE_KEY"] | |
puts "you need to set your BUILDKITE_KEY" |
This file contains hidden or 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 'googleauth' | |
require 'httparty' | |
require 'active_support/all' | |
class GDirectory | |
# https://github.com/jnunemaker/httparty | |
include HTTParty |
This file contains hidden or 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 'openssl' | |
require 'securerandom' | |
require 'byebug' | |
# http://docs.ruby-lang.org/en/2.1.0/OpenSSL/Cipher.html#class-OpenSSL::Cipher-label-Authenticated+Encryption+and+Associated+Data+-28AEAD-29 | |
# http://security.stackexchange.com/questions/17044/when-using-aes-and-cbc-is-it-necessary-to-keep-the-iv-secret | |
ENV['ENCRYPTED_ATTRIBUTES_KEY']=SecureRandom.hex(40) #This isn't a real key used anywhere but it's representative | |
ENV['ENCRYPTED_ATTRIBUTES_ALGORITHM']='aes-256-gcm' |
This file contains hidden or 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
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: god | |
# Required-Start: $remote_fs $syslog | |
# Required-Stop: $remote_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: God initscript | |
### END INIT INFO |
This file contains hidden or 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
ree-1.8.7-2010.02 :001 > def me | |
ree-1.8.7-2010.02 :002?> yield | |
ree-1.8.7-2010.02 :003?> end | |
=> nil | |
ree-1.8.7-2010.02 :004 > | |
ree-1.8.7-2010.02 :005 > me do | |
ree-1.8.7-2010.02 :006 > begin | |
ree-1.8.7-2010.02 :007 > raise "goobers" | |
ree-1.8.7-2010.02 :008?> rescue | |
ree-1.8.7-2010.02 :009?> p "I caught the goober" |
This file contains hidden or 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
# http://rspec.info/ | |
# http://peepcode.com/products/rspec-user-stories | |
# http://dannorth.net/whats-in-a-story | |
# http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1 | |
# http://www.benmabey.com/2008/05/19/imperative-vs-declarative-scenarios-in-user-stories/ | |
# http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/ | |
# http://www.chariotsolutions.com/slides/pdfs/ete2008-IntegrationTestingWithRSpec.pdf | |
# http://www.joesniff.co.uk/ruby/telling-a-good-story-rspec-stories-from-the-trenches.html | |
# How does using stories help testing? |
This file contains hidden or 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
Story: Visitor should be able to log in | |
As a visitor | |
I should be able to login | |
So that I can have access to the application | |
Scenario: Visitor visits the home page | |
Given a logged out visitor | |
When visitor goes to the home page | |
Then visitor should see the sessions/new page |
This file contains hidden or 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
#faking the rails class to keep the test simple | |
class Rails | |
def self.env | |
"development" | |
end | |
end | |
def get_descriptor(descriptor, descriptor_keys = Rails.env, i = 0) | |
if descriptor.is_a?(Array) || descriptor.is_a?(String) | |
descriptor |
This file contains hidden or 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
SELECT MAKEDATE(YEAR(CURRENT_DATE()),DAYOFYEAR(CURRENT_DATE()) - rn.id + 1) as `date`, | |
( | |
SELECT SUM(ROUND(rp.amount/(rp.interval * 30) * IF(spay.service_end_date,1,0),2)) as dv | |
FROM subscribers sub | |
JOIN subscriptions s ON s.subscriber_id = sub.id AND s.is_suspended = false AND s.autobill_failure_count = 0 | |
JOIN subscription_plans sp ON sp.id = s.subscription_plan_id AND sp.id NOT IN (6,12) | |
JOIN renewal_periods rp ON s.renewal_period_id = rp.id | |
JOIN subscription_payments spay ON spay.subscription_id = s.id | |
WHERE s.deleted_at IS NULL | |
AND DATE(spay.service_begin_date) <= `date` |
NewerOlder