Skip to content

Instantly share code, notes, and snippets.

View samsonasu's full-sized avatar

Brian Samson samsonasu

View GitHub Profile
### Keybase proof
I hereby claim:
* I am samsonasu on github.
* I am samsonasu (https://keybase.io/samsonasu) on keybase.
* I have a public key ASD1cOpPEfwMx1ip4JX2Skyx_Uw6gSJfC9CXgrb_vKCEaQo
To claim this, I am signing this object:
@samsonasu
samsonasu / paperclip_cve_MONKEYPATCH.rb
Last active January 30, 2018 15:55
Paperclip 4 CVE patch
# https://github.com/thoughtbot/paperclip/pull/2435/files
module Paperclip
class AdapterRegistry
def unregister(handler_class)
@registered_handlers.reject! { |_, klass| klass == handler_class }
end
end
end
class TestMailer < ActionMailer::Base
def notify_irc
puts "This is a test"
binding.pry
mail(subject: "Test", body: "body")
end
end
###
[3] pry(main)> TestMailer.notify_irc
This is a test
#import "AppVersion.h"
#import <Cordova/CDVPluginResult.h>
@implementation AppVersion
- (void)getVersionNumber:(CDVInvokedUrlCommand*)command
{
NSString* callbackId = command.callbackId;
NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
# This might be too fancy
serializer = Class.new(CarePathStageSerializer) do
@@patient_care_path = nil
def initialize(object, options={})
super(object, options)
@patient_care_path = @@patient_care_path
end
def self.current_patient_care_path=(pcp)
@@patient_care_path = pcp
node = Bitcoin::Network::Node.new({
network: :dogecoin,
:log => {
:network => :debug,
:storage => :debug,
}
})
node.run
@samsonasu
samsonasu / gist:8088356
Created December 22, 2013 20:57
bitcoin-ruby error connecting to litecoin
DEBUG storage: new block 32fe3927752fd3277edb3ff007573086b73dd0ce31eeeb51ca5c770361397d0b
DEBUG storage: validating block syntax 32fe3927752fd3277edb3ff007573086b73dd0ce31eeeb51ca5c770361397d0b (215 bytes)
WARN network: ValiationError storing block 32fe3927752fd3277edb3ff007573086b73dd0ce31eeeb51ca5c770361397d0b: block error: syntax check 2 - bits failed
DEBUG storage: new block 5453671a92f6f32c52e191f9801e3a4c44562f4edbe5952abf8b46adfc6bde98
DEBUG storage: validating block syntax 5453671a92f6f32c52e191f9801e3a4c44562f4edbe5952abf8b46adfc6bde98 (215 bytes)
WARN network: ValiationError storing block 5453671a92f6f32c52e191f9801e3a4c44562f4edbe5952abf8b46adfc6bde98: block error: syntax check 2 - bits failed
DEBUG storage: new block e9c9bfb156b755d3efab4e45c449f11567af3e82df50d6099b8dffe214649087
DEBUG storage: validating block syntax e9c9bfb156b755d3efab4e45c449f11567af3e82df50d6099b8dffe214649087 (215 bytes)
WARN network: ValiationError storing block e9c9bfb156b755d3efab4e45c449f11567af3e82df50d6099b8dffe214
Xandra:rails bsamson$ rvm install ruby-1.9.3-p484
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.8/x86_64/ruby-1.9.3-p484.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Error: No available formula for gcc46
Installing requirements for osx.
Updating system........
Error running 'requirements_osx_brew_update_system ruby-1.9.3-p484',
please read /Users/bsamson/.rvm/log/1386126262_ruby-1.9.3-p484/update_system.log
@samsonasu
samsonasu / bar.rb
Last active December 25, 2015 15:59
class CurrentSession
attr_reader :session
def initialize(session)
session[:user] ||= { } # Create a session for user if it isn't already present
@session = session
end
def logged_in?
session[:user].present?
@samsonasu
samsonasu / mockingbird.rb
Created October 9, 2012 23:10
Mockingbird example
class Mockingbird < ActiveRecord::Base
attr_accessible :color
def chirp!
"chirp"
end
def tweet!
"tweet"
end