Skip to content

Instantly share code, notes, and snippets.

View workmad3's full-sized avatar

David Workman workmad3

View GitHub Profile
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile /path/to/certificate.crt
SSLCertificateKeyFile /path/to/certificate.key
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/var/www/cgi-bin">
SSLOptions +StdEnvVars
</Directory>
unless Kernel.methods.include?(:require_relative)
puts "Patching in require_relative"
def require_relative(*args)
$: << File.dirname(__FILE__) unless $:.include?(File.dirname(__FILE__))
require(*args)
end
end
class Component < ActiveRecord::Base
has_many :components
#this is the 'other side' of the has_many :components statement
belongs_to :component
has_one :sub_component
end
class Abstract
class << self
private :new
end
def self.inherited(klass)
class << klass
public :new
end
end
end
it "should call the callback :before_add" do
@callback = lambda {true}
@record.class.has_and_belongs_to_many_active_resource :resourcen, :before_add => @callback
@record.resource_ids = [1]
@callback.should_receive(:call)
@record.add_resource(5)
end
module Kernel
def with(obj, &blk)
obj.instance_eval &blk
end
end
a = lambda {return}
def test1
yield
end
def test2(&blk)
blk.call
end
test1 &a
class Array
def between startline, endline
self[index(startline)..index(endline)]
end
end
module MyModule
def self.included(base)
base.instance_eval { validates_inclusion_of :type, :in => [:public, :private, :static] }
end
//rest of module here
end
class Product < ActiveRecord::Base
scope :for_sale, order('title')
end
Product.for_sale