Skip to content

Instantly share code, notes, and snippets.

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;
// 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)!) {
}
}
@GriffinHeart
GriffinHeart / promises.coffee
Last active August 29, 2015 14:06
waterfall to promises
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'
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'
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
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'
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
//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} />
//client side
match({ routes, location }, (error, redirectLocation, renderProps) => {
render(
<Provider store={store}>
<ContextHolder context={context}>
<Router {...renderProps} children={routes} history={Location} />
</ContextHolder>
</Provider>,
appContainer
);
// Fetcher file
const handleErrors = async (...myargs) => {
const response = await originalFetch(...myargs);
if (!response.ok) {
throw Error(response.statusText);
}
return response;
};