Skip to content

Instantly share code, notes, and snippets.

Host Agent
37.187.136.15 /BitCoinJ:0.12SNAPSHOT/Satoshi:0.11.0/: version 70001, blocks=370279, us=127.0.0.1:8333, peerid=5124
@rromanchuk
rromanchuk / gist:967646
Created May 11, 2011 23:48
decoding signed request for canvas facebook app or page
def parse_signed_request(request)
# Facebook's signed requests come in two parts -- the signature and the data payload
# see http://developers.facebook.com/docs/authentication/canvas
return {} if request.blank?
encoded_sig, payload = request.split(".")
sig = base64_url_decode(encoded_sig)
# if the signature matches, return the data, decoded and parsed as JSON
if OpenSSL::HMAC.digest("sha256", FB[:secret_key], payload) == sig
@rromanchuk
rromanchuk / gist:979707
Created May 18, 2011 22:13
Refunding paypal xpress checkout
Paypal.sandbox!
r = Paypal::NVP::Request.new(:username => PAYPAL[:username], :password => PAYPAL[:password], :signature => PAYPAL[:signature])
r.request('RefundTransaction', {'TRANSACTIONID' => '2VV74337KH776410C', 'REFUNDTYPE' => 'Full'})
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source .bash_profile
rvm install 1.9.2
rvm gemset create r3
rvm use 1.9.2@r3 --default
@rromanchuk
rromanchuk / gist:1453014
Created December 9, 2011 19:51
ruby-debug19 with ruby 1.9.3 with RVM
export RVM_SRC=/Users/ryan/.rvm/src/ruby-1.9.3-p0
# get the following here http://rubyforge.org/frs/?group_id=8883
gem install archive-tar-minitar
gem install ruby_core_source-0.1.5.gem -- --with-ruby-include=/$RVM_SRC
gem install linecache19-0.5.13.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=/$RVM_SRC
gem install ruby-debug19-0.11.6.gem -- --with-ruby-include=/$RVM_SRC
@rromanchuk
rromanchuk / gist:1453178
Created December 9, 2011 20:32
Stack level too deep calling Mailer inside rails runner/eventmachine due to super recursion
rdb:1) where
--> #0 AbstractController::Rendering.initialize
at line /Users/ryan/.rvm/gems/ruby-1.9.3-p0@r311/gems/actionpack-3.1.3/lib/abstract_controller/rendering.rb:73
#1 AbstractController::Layouts.initialize
at line /Users/ryan/.rvm/gems/ruby-1.9.3-p0@r311/gems/actionpack-3.1.3/lib/abstract_controller/layouts.rb:301
#2 ActionDispatch::Routing::UrlFor.initialize
at line /Users/ryan/.rvm/gems/ruby-1.9.3-p0@r311/gems/actionpack-3.1.3/lib/action_dispatch/routing/url_for.rb:103
#3 AbstractController::Rendering.initialize
at line /Users/ryan/.rvm/gems/ruby-1.9.3-p0@r311/gems/actionpack-3.1.3/lib/abstract_controller/rendering.rb:75
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@rromanchuk
rromanchuk / gist:2498121
Created April 26, 2012 09:30
Accessing setting constants in django, non idiotic way.
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag
def settings_value(name):
try:
test = settings.__getattr__(name)
return test
@rromanchuk
rromanchuk / UIDeviceHardware.h
Created October 31, 2012 10:49 — forked from Jaybles/UIDeviceHardware.h
UIDeviceHardware - Determine iOS device being used
//
// UIDeviceHardware.h
//
// Used to determine EXACT version of device software is running on.
#import <Foundation/Foundation.h>
@interface UIDeviceHardware : NSObject
- (NSString *) platform;
@rromanchuk
rromanchuk / bitcoin.conf
Last active November 12, 2015 00:55
BIP101 Testnet
maxconnections=120
minrelaytxfee=0
testnet=1
dbcache=200 #for a 2 GB server
# dbcache=1000 #for a 4 GB server
# Only relevant for those running jtoomim's eviction branch
# maxmempoolbytes=400000000