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 backend { | |
server unix:/tmp/unicorn.sock; | |
} | |
location @app { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_redirect off; |
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
// error: Type 'Stations' does not conform to protocol 'NSObjectProtocol' | |
class Stations: MLPAutoCompleteTextFieldDataSource { | |
func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!) -> [AnyObject]! { | |
} | |
func autoCompleteTextField(textField: MLPAutoCompleteTextField!, possibleCompletionsForString string: String!, completionHandler handler: (([AnyObject]!) -> Void)!) { | |
} | |
} |
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
Promise = require 'bluebird' | |
methodB = -> | |
p = new Promise (resolve, reject)-> | |
setTimeout -> | |
console.log 'doing methodB' | |
reject 'failed b' | |
, 1000 | |
p.catch (e)-> | |
console.log 'log error to methodB.log' |
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
Promise = require 'bluebird' | |
methodB = -> | |
p = new Promise (resolve, reject)-> | |
setTimeout -> | |
console.log 'doing methodB' | |
reject Error('failed b') | |
, 1000 | |
p.error (e)-> | |
console.log 'log error to methodB.log' |
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
gem 'active_model_serializers', github: 'rails-api/active_model_serializers', branch: '0-10-stable' | |
class Item | |
include Mongoid::Document | |
include Mongoid::Timestamps | |
end | |
def index | |
render json: Item.all | |
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
the_password = 'DO_NOT_USE_THIS_PASSWORD' | |
pem_key_with_password = OpenSSL::PKey::RSA.new(2048).to_pem(OpenSSL::Cipher.new('aes-256-gcm'), the_password) | |
loaded_key = OpenSSL::PKey::RSA.new(pem_key_with_password, the_password) | |
boom! | |
OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key: nested asn1 error | |
from (irb):34:in `initialize' | |
from (irb):34:in `new' |
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
class User < ActiveRecord::Base | |
has_many :combo_instances | |
end | |
class ComboGame < ActiveRecord::Base | |
has_many :combo_instances | |
attr_reader :game_result | |
validates :hits_required, presence: true |
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
//client side | |
const { pathname, search, hash } = window.location; | |
const location = `${pathname}${search}${hash}`; | |
match({ routes, location }, (error, redirectLocation, renderProps) => { | |
console.log(renderProps); | |
console.log(location); | |
render( | |
<Provider store={store}> | |
<ContextHolder context={context}> | |
<Router {...renderProps} children={routes} history={Location} /> |
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
//client side | |
match({ routes, location }, (error, redirectLocation, renderProps) => { | |
render( | |
<Provider store={store}> | |
<ContextHolder context={context}> | |
<Router {...renderProps} children={routes} history={Location} /> | |
</ContextHolder> | |
</Provider>, | |
appContainer | |
); |
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
// Fetcher file | |
const handleErrors = async (...myargs) => { | |
const response = await originalFetch(...myargs); | |
if (!response.ok) { | |
throw Error(response.statusText); | |
} | |
return response; | |
}; |
OlderNewer