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
| Rails::Rack::Logger.class_eval do | |
| def call_with_quiet_assets(env) | |
| previous_level = Rails.logger.level | |
| Rails.logger.level = Logger::ERROR if env['PATH_INFO'].index("/assets/") == 0 | |
| call_without_quiet_assets(env).tap do | |
| Rails.logger.level = previous_level | |
| end | |
| end | |
| alias_method_chain :call, :quiet_assets | |
| 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
| class ActionMailer::Base | |
| default 'X-SMTPAPI' => lambda { | |
| { 'category' => "#{mailer_name}.#{@template}", | |
| 'unique_args' => (@unique_args || {}) | |
| }.to_json | |
| } | |
| 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
| rake assets:precompile && git add --all public && git commit -m 'precompile assets' |
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
| # See https://www.fededirectory.frb.org/format.cfm | |
| # | |
| # Run this by doing `ruby parser.rb` | |
| require 'rubygems' | |
| require 'json' | |
| require 'sinatra' | |
| $db = {} |
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
| begin | |
| balanced_account = Balanced::Marketplace.my_marketplace.create_merchant(email, merchant_hash, bank_account_uri, name) | |
| rescue Balanced::Error => ex | |
| if ex.response[:status] == 409 | |
| # A 409 is returned if the account has already been created. | |
| # Balanced will return the account uri in the error response, so we simply need to | |
| # create an internal account on our end. | |
| decoded_body = ex.response[:body] | |
| uri = decoded_body['extras']['account_uri'] |
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 PostsController | |
| def create | |
| post = Post.new params[:post] | |
| if post.save | |
| render s |
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
| # Your standard foreman Procfile | |
| api-server: bundle exec rails s -p 3000 | |
| postgres: postgres -D /usr/local/var/postgres | |
| service-runner: ./bin/run-services |
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_self | |
| *= require_tree ./../../../vendor/assets/stylesheets | |
| *= require_tree . | |
| */ |
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
| module Rack | |
| class Promiscuity | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) | |
| request = Rack::Request.new(env) | |
| status, headers, body = @app.call(env) |
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
| # Redis configuration file example | |
| # Note on units: when memory size is needed, it is possible to specifiy | |
| # it in the usual form of 1k 5GB 4M and so forth: | |
| # | |
| # 1k => 1000 bytes | |
| # 1kb => 1024 bytes | |
| # 1m => 1000000 bytes | |
| # 1mb => 1024*1024 bytes | |
| # 1g => 1000000000 bytes |