This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Abstract | |
| class << self | |
| private :new | |
| end | |
| def self.inherited(klass) | |
| class << klass | |
| public :new | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Kernel | |
| def with(obj, &blk) | |
| obj.instance_eval &blk | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| a = lambda {return} | |
| def test1 | |
| yield | |
| end | |
| def test2(&blk) | |
| blk.call | |
| end | |
| test1 &a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Array | |
| def between startline, endline | |
| self[index(startline)..index(endline)] | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module MyModule | |
| def self.included(base) | |
| base.instance_eval { validates_inclusion_of :type, :in => [:public, :private, :static] } | |
| end | |
| //rest of module here | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Product < ActiveRecord::Base | |
| scope :for_sale, order('title') | |
| end | |
| Product.for_sale |