View init.rb
This file contains 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
# rails/init.rb | |
require 'marshalize' | |
ActiveRecord::Base.send(:include, Marshalization::Base) | |
ActiveRecord::Base.send(:include, Marshalization::AttributeMethods) | |
ActiveRecord::Base.send(:include, Marshalization::Dirty) |
View I'd like to...
This file contains 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
- use respond_to (or something else?) in send_data to externalize the .js processing, in the same fashion one would use a .rjs file. | |
- be able to use :method => "get" without triggering the show action. |
View hello
This file contains 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
actually it's views/hello.md, but gist would trigger Markdown highlighting | |
# Fibonacci numbers in Ruby | |
:::ruby | |
def fib(n) | |
if n < 2 | |
1 | |
else | |
fib(n-2) + fib(n-1) |
View Gemfile
This file contains 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
source 'http://gemcutter.org' | |
gem "rails", "3.0.0.beta" | |
gem "sqlite3-ruby", :require => "sqlite3" | |
gem "test-unit" | |
gem "rspec-rails", ">= 2.0.0.beta.1" | |
gem 'capybara' | |
gem 'database_cleaner' |
View gem list
This file contains 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
$ gem list | |
*** LOCAL GEMS *** | |
abstract (1.0.0) | |
actionmailer (3.0.0.beta) | |
actionpack (3.0.0.beta) | |
activemodel (3.0.0.beta) | |
activerecord (3.0.0.beta) | |
activeresource (3.0.0.beta) |
View log nested
This file contains 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
# no explicit reference to web_steps | |
# that is, features/authentication/step_definitions/authentication_steps.rb contains: | |
Given /^I am not authenticated$/ do | |
# do nothing | |
end | |
$ cucumber features/authentication/authentication.feature | |
Using the default profile... | |
Feature: User authentication | |
To ensure the safety of the application |
View base.rb
This file contains 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
# ./base.rb | |
require 'base/plugins' | |
module Base | |
class Server | |
include Plugins | |
def say(what) | |
p "say: #{what}" |
View plugins_standalone.rb
This file contains 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 Base | |
class Server | |
def blabla(argument) | |
@config ||= "default" | |
if @config == "default" | |
p "Server says: #{argument}" | |
end | |
puts "config: #{@config}" |
View plugins.rb
This file contains 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 Base | |
module Plugins | |
def self.plugins | |
@plugins ||= [] | |
end | |
def self.activate plugin_name | |
begin | |
plugin = Base::Plugins.const_get(plugin_name.capitalize) | |
rescue |
View do.rb
This file contains 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
require 'facets/kernel/constant' | |
require 'active_support/core_ext/module/attribute_accessors' | |
module Metamorphosis | |
module Injector | |
@@receiver = "Foo" | |
def clutch cst_path, *directives, &blk | |
raise ArgumentError unless cst = Object.constant([@@receiver, cst_path].join("::")) | |
raise ArgumentError unless cst.is_a? Class or cst.is_a? Module |
OlderNewer