Skip to content

Instantly share code, notes, and snippets.

View schneems's full-sized avatar

Richard Schneeman schneems

View GitHub Profile
scp -p -i <amazon private key file> <file to transfer> root@<ec2-....compute-1.amazonaws.com>:<destination file in amazon server>
scp -p -i <amazon private key file> <file to transfer> root@<ec2-....compute-1.amazonaws.com>:<destination file in amazon server>
@schneems
schneems / validate_facebook_signature.rb
Created December 20, 2010 20:37
validate facebook signed_request in ruby
require 'base64'
def base64_url_decode(str)
str += '=' * (4 - str.length.modulo(4))
Base64.decode64(str.gsub("-", "+").gsub("_", "/"))
end # source: https://github.com/ptarjan/base64url/blob/master/ruby.rb
require 'hmac'
require 'hmac-sha2' ## used to decode facebook return values
@schneems
schneems / gist:952186
Created May 2, 2011 19:22
Places to check out while teaching in austin
Places to check out while you're in Austin: http://gowalla.com/in/austin
Up North - (Near Executrain)
- Alamo Drafthouse (movies + food + drinks) [http://www.originalalamo.com/]
- NXNW brewery (beer + food)
- Bombay Bistro (indian food)
- Texmex
- Iron Cactus
- Chuys
- Torchys Tacos
@schneems
schneems / drinking_parks_in_austin
Created May 10, 2011 04:16
Parks in Austin Where Drinking is Legal
# Parks in Austin Where Drinking is Legal
Source:
http://www.ci.austin.tx.us/parks/picnic.htm#northeast
Deep Eddy
401 Deep Eddy Avenue
Emma Long Metropolitan Park
1600 City Park Road
@schneems
schneems / gist:1182175
Created August 30, 2011 21:51
akephalos and capybara 1.0.0 errors
1) Capybara::Session with akephalos driver it should behave like session#reset_session! resets current host
Failure/Error: @session.current_host.should be_nil
expected: nil
got: "http://capybara-testapp.heroku.com"
Shared Example Group: "session" called from ./spec/integration/capybara/session_spec.rb:22
# /Users/me/.rvm/gems/ree-1.8.7-2011.03@proj/gems/rspec-expectations-2.6.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /Users/me/.rvm/gems/ree-1.8.7-2011.03@proj/gems/rspec-expectations-2.6.0/lib/rspec/expectations/handler.rb:21:in `handle_matcher'
# /Users/me/.rvm/gems/ree-1.8.7-2011.03@proj/gems/rspec-expectations-2.6.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
# /Users/me/.rvm/gems/ree-1.8.7-2011.03@proj/gems/capybara-1.0.1/lib/capybara/spec/session.rb:64
# /Users/me/.rvm/gems/ree-1.8.7-2011.03@proj/gems/rspec-core-2.6.4/lib/rspec/core/example.rb:48:in `instance_eval'
module Foo
def self.Bar
puts "woot"
end
Bar = self.Bar
end
Foo::Bar # => "woot"
@schneems
schneems / gist:1443757
Created December 7, 2011 17:41
Add Callback Logging to ActiveSupport and Apply Filter logging to AbstractController

This is a patch i'm interested in submitting to rails https://github.com/schneems/rails/commits/schneems/log_controller_filters/ (last two commits) but first I want some feedback. Here is a writeup similar to how I would structure a PR. All comments welcome, especially alternative implementation & style, here it goes...

UPDATE: Pull request submitted, please post any comments there: rails/rails#3929

What

Adding the ability to easily log callbacks.

@schneems
schneems / gist:1444018
Created December 7, 2011 18:36
Convert Yaml_DB fields
data = File.read(File.join(Rails.root, 'db', 'data.yml'))
documents = YAML.load_documents(data)
#=====================================================================
class YamlDb::Document < Hash
gem 'actionmailer', :path => '/Users/schneems/documents/projects/rails/actionmailer'
gem 'actionpack', :path => '/Users/schneems/documents/projects/rails/actionpack'
gem 'activemodel', :path => '/Users/schneems/documents/projects/rails/activemodel'
gem 'activerecord', :path => '/Users/schneems/documents/projects/rails/activerecord'
gem 'activeresource', :path => '/Users/schneems/documents/projects/rails/activeresource'
gem 'activesupport', :path => '/Users/schneems/documents/projects/rails/activesupport'
gem 'railties', :path => '/Users/schneems/documents/projects/rails/railties'