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 'net/http' | |
require 'json' | |
def alert_to_slack(env) | |
uri = URI.parse('https://hooks.slack.com/services/<uri>') | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'}) | |
request.body = { | |
"channel" => '#channel', |
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
@import "compass/css3/appearance"; | |
@import "h5bp"; | |
@import "compass/reset"; | |
@import "compass/css3"; | |
@import "compass/css3/pie"; | |
@import "compass/css3/images"; | |
@import "compass/typography"; | |
@import "compass/layout/grid-background"; | |
@import "compass/css3/box-sizing"; | |
@import "compass/utilities/sprites/base"; |
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
// Bootstrap components | |
@import "bootstrap/normalize"; | |
@import "bootstrap/variables"; | |
@import "bootstrap/mixins"; | |
@import "bootstrap/scaffolding"; | |
@import "bootstrap/type"; | |
@import "bootstrap/grid"; | |
@import "bootstrap/tables"; | |
@import "bootstrap/forms"; | |
@import "bootstrap/buttons"; |
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) } |
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
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
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
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
# 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
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 |
NewerOlder