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
DROP FUNCTION fn_determine_60_day_message_count_emv(in_target_profileble_id integer, in_service_name text); | |
CREATE FUNCTION fn_determine_60_day_message_count_emv(in_target_profileble_id integer, in_service_name text) RETURNS integer | |
LANGUAGE plpgsql | |
AS $$ | |
DECLARE | |
var_message_count_emv int := null; | |
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
pg_dump <db_name> > <bkup_name>.dump -U <user> -Fc -h localhost | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U <user> -d <db_name> <bkup_name>.dump |
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
describe 'SomethingMailer' do | |
include Rails.application.routes.url_helpers | |
let(:something) { create :something } | |
describe 'accepted' do | |
let(:mail) { SomethingMailer.accepted(something) } | |
it 'renders the subject' do | |
mail.subject.should == 'Subject Accepted' | |
end |
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
You should have 2 repositories | |
origin - your fork | |
upstream - main repository | |
<fork repository> | |
0. git clone [email protected]:you/project.git | |
1. git remote add upstream [email protected]:our/project.git | |
2. git checkout master | |
3. git pull upstream master | |
4. git checkout -b my-important-feature |
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
# spec/support/capybara.rb | |
require 'capybara/rspec' | |
require 'capybara/rails' | |
Capybara.javascript_driver = :webkit | |
Capybara.app_host = 'lvh.me' | |
Capybara.always_include_port = true | |
# spec/support/host_for_subdomains.rb |
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
class ElementCacheWorker | |
include Sidekiq::Worker | |
include Rails.application.routes.url_helpers | |
sidekiq_options retry: true, failures: true | |
def perform(element_id) | |
element = Element.where(id: element_id).first | |
if element.present? |
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
require 'spec_helper' | |
describe 'Sponsorships' do | |
include Warden::Test::Helpers | |
describe 'Sponsorships Application form', :js do | |
let(:proposal) { Faker::Lorem.paragraphs(20).join('.') } | |
it 'fills out the form and submit' do |
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
Geocoder.configure(:lookup => :test) | |
Geocoder::Lookup::Test.set_default_stub( | |
[ | |
{ | |
'latitude' => 40.7143528, | |
'longitude' => -74.0059731, | |
'address' => 'New York, NY, USA', | |
'state' => 'New York', | |
'state_code' => 'NY', |
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
find app/views/ -name '*.html.haml' | while read p; do haml-i18n-extractor $p -n -y config/locales/views/$(echo $p | sed 's/app\/views\///g' | sed 's/.html.haml/.yml/g') && echo $p; done | |
remember to put this to application.rb: | |
config.i18n.load_path += Dir[Rails.root.join('config', 'locales', '**', '*.{rb,yml}')] | |
after that might need to run | |
grep -Rl "'\"" config/locales/ | while read p; do sed -i "s/'\"/'/g" $p && sed -i "s/\"'/'/g" $p; done |
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
class ApplicationController < ActionController::Base | |
# Prevent CSRF attacks by raising an exception. | |
# For APIs, you may want to use :null_session instead. | |
protect_from_forgery with: :exception | |
unless Rails.application.config.consider_all_requests_local | |
rescue_from Exception, with: lambda { |exception| Airbrake.notify(exception); render_error(500) } | |
rescue_from ActionView::MissingTemplate, ActiveRecord::RecordNotFound, ActionController::RoutingError, | |
ActionController::UnknownController, AbstractController::ActionNotFound, ActiveRecord::RecordNotFound, | |
ActionController::UnknownFormat, with: lambda { |exception| render_error(404) } |
OlderNewer