Person:
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
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"plugins": ["react"], | |
"ecmaFeatures": { |
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
# DelayedJob | |
@user.delay.activate!(@device) # Delay any object | |
Notifier.delay.signup(@user) # Delay ActionMailer | |
#DelayedJob supports a number of ways to make methods async | |
def send_mailer | |
# Some other code | |
end | |
handle_asynchronously :send_mailer, :priority => 20 |
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
upstream unicorn { | |
server unix:/tmp/unicorn.app.sock fail_timeout=0; | |
} | |
# HTTP server | |
# | |
server { | |
listen localhost:8080; | |
server_name app.me; |
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
<div id="error_page" class="box"> | |
<h1>Ops, 404</h1> | |
<p> | |
似乎没有这个页面哦!大哥,去看看别的吧。 | |
</p> | |
</div> | |
<!--因为不排除连rails 都无法运行的情况 所以添加 'public/STATUS.htm' 还是很有必要的--> | |
<!--more> | |
Finally, the default exceptions application used by Rails that simply renders a page in `public/STATUS.html` is available here: [action_dispatch/middleware/public_exceptions.rb](https://github.com/rails/rails/blob/master/actionpack/lib/action_dispatch/middleware/public_exceptions.rb) | |
Remember that whatever you do in the errors controller, it should not be anything “fancy”. Keep it simple because something already went wrong with your application! |
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
module Wysihtml5Helper | |
def fill_in_html name, options | |
options.to_options!.assert_valid_keys :with | |
if Capybara.current_driver == Capybara.javascript_driver | |
# Dip inside capybara session to respect current `within` scope | |
scope = page.send(:current_node).path | |
# Find the textarea based on label name within the given scope | |
query = "$('label:contains(#{name.inspect}) ~ textarea:eq(0)', document.evaluate(#{scope.inspect}, document).iterateNext())" | |
# Make sure the editor is instantiated -- this is us, not wysihtml5 | |
wait_until { page.evaluate_script("!!#{query}.data('editor')") } |
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 'sinatra' | |
require 'rollbar' | |
configure do | |
Rollbar.configure do |config| | |
config.access_token = 'aaaabbbbccccddddeeeeffff00001111' | |
config.environment = 'sinatra-test' | |
end | |
end |
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
# Say you want to look up the attrs of a Stripe Event for logging to your internal database. | |
attrs = begin | |
retriable(Stripe::APIConnectionError, Stripe::APIError, max: 25) do | |
# ... retrieve attrs from the Stripe event here... | |
end | |
rescue Stripe::APIConnectionError, Stripe::APIError | |
# We're inside an SQS queue block | |
throw :skip_delete # we'll just have to wait on this event, come back later | |
rescue Stripe::Error | |
notify $! |
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
backend default { | |
.host = "127.0.0.1"; | |
.port = "3000"; | |
} | |
acl admin { | |
"127.0.0.1"; | |
} | |
sub vcl_recv { |
Run the usual brew update
, and brew upgrade
to get the latest 9.4 version of PostgreSQL.
After upgrading PG from 9.3 to 9.4 with brew, the server will not start as is. If you value your database contents, and configuration, pg_upgrade
is here to migrate those.
Do not delete the old binaries at once: do not run brew cleanup
, because you need 9.3 binaries to migrate.