Skip to content

Instantly share code, notes, and snippets.

View kbighorse's full-sized avatar

Kimball Bighorse kbighorse

View GitHub Profile
class Vehicle
def delayed_do_something
DoSomethingWorker.perform_async(self.id)
end
# this should be where all the real action is
def do_something
puts 'hello'
end
@kbighorse
kbighorse / gist:6939963
Created October 11, 2013 18:46
Good tool_provider and request.
GOOD:
=> #<IMS::LTI::ToolProvider:0x007fb4f1425f88
@consumer_key="test",
@consumer_secret="secret",
@context_id="creativity13",
@context_title="Crash Course in Creativity",
@custom_params=
{"message_from_sinatra"=>"hey from the sinatra example consumer"},
@kbighorse
kbighorse / gist:6939929
Created October 11, 2013 18:44
Bad tool_provider and request.
BAD:
=> #<IMS::LTI::ToolProvider:0x007ff1923a0058
@consumer_key="test",
@consumer_secret="secret",
@context_id="1",
@context_label="venture",
@context_title="Technology Entrepreneurship",
@custom_params=
{"complex____________key"=>"Complex!@\#$^*(){}[]\u00BDValue",
"simple_key"=>"custom_simple_value"},
1.9.2p320 :006 > t = BraintreeRails::Transaction.find '46bg2b'
[Braintree] [07/May/2013 22:00:09 UTC] GET /transactions/46bg2b 200
=> #<BraintreeRails::Transaction:0x007fcea4d113c8 @persisted=true, @amount=#<BigDecimal:7fcea4d13380,'0.1E1',9(18)>, @channel=nil, @custom_fields={}, @descriptor=#<Braintree::Descriptor:0x007fcea4d11508 @name=nil, @phone=nil>, @merchant_account_id="44pyrm5p8f5ycf7v", @order_id=nil, @purchase_order_number=nil, @recurring=false, @tax_amount=nil, @tax_exempt=false, @type="sale", @avs_error_response_code=nil, @avs_postal_code_response_code="M", @avs_street_address_response_code="M", @billing_details=#<Braintree::Transaction::AddressDetails:0x007fcea4d126b0 @id="tf", @first_name="fake", @last_name="merchant", @company="Springfield city", @street_address="123 evergreen terrace", @extended_address="#3", @locality="Palo Alto", @region="Alaska", @postal_code="94301", @country_name="United States of America", @country_code_alpha2="US", @country_code_alpha3="USA", @country_code_numeric="840
<form accept-charset="UTF-8" action="/transactions" class="simple_form form-horizontal" id="braintree-transaction-form" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="&#x2713;" />
<input name="authenticity_token" type="hidden" value="c4J1kjuAWYKcUSXkUH9GBnkI3dPyKbcWKQT9h/sW2og=" />
</div>
<div class="input string optional braintree_rails_transaction_amount">
<label class="string optional" for="braintree_rails_transaction_amount">Amount</label>
<input class="string optional" id="braintree_rails_transaction_amount" name="braintree_rails_transaction[amount]" size="50" type="text" value="10" />
</div>
<div class="input string required braintree_rails_transaction_credit_card_number">
input {
stdin {
type => "stdin-type"
}
file {
type => "linux-syslog"
path => ["/path/to/production.log"]
}
}
input {
redis {
host => "10.0.0.1"
type => "redis-input"
# these settings should match the output of the agent
data_type => "list"
key => "logstash"
# We use json_event here since the sender is a logstash agent
format => "json_event"
=> #<ActionDispatch::Request:0x007fbf291d5688
@env=
{"GATEWAY_INTERFACE"=>"CGI/1.1",
"PATH_INFO"=>"/",
"QUERY_STRING"=>"test=hello",
"REMOTE_ADDR"=>"127.0.0.1",
"REMOTE_HOST"=>"localhost",
"REQUEST_METHOD"=>"GET",
"REQUEST_URI"=>"http://localhost:5000/?test=hello",
"SCRIPT_NAME"=>"",
$ java -jar logstash-1.1.9-monolithic.jar agent -f apache-elasticsearch.conf -- web --backend 'elasticsearch:///?local'
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/version.rb:4 warning: already initialized constant VERSION
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/version.rb:5 warning: already initialized constant VERSION_ARRAY
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/version.rb:6 warning: already initialized constant VERSION_MAJOR
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/version.rb:7 warning: already initialized constant VERSION_MINOR
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/version.rb:8 warning: already initialized constant VERSION_BUILD
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/json-1.7.7/lib/json/common.rb:100 warning: already initialized constant NaN
/Users/kimball/.rvm/gems/ruby-1.9.3-p392@tradingpost/gems/j
# development.rb
...
config.middleware.use(Rack::ReverseProxy) do
reverse_proxy_options :preserve_host => true
reverse_proxy '/blog', 'http://bighorse.net'
end
...