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
| dir = File.dirname(__FILE__) | |
| rails_root = File.join(dir, '..', '..', '..', '..') | |
| ENV["RAILS_ENV"] = "test" | |
| ENV["RAILS_ROOT"] = rails_root | |
| require File.join(rails_root, 'config', 'environment') | |
| require 'test/unit' | |
| require 'action_view/test_case' |
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
| // | |
| // | |
| // GMail Item Links | |
| // Wowhead itemlinks, yay. | |
| // | |
| // | |
| // | |
| // | |
| // 42 | |
| // |
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 Less | |
| class Engine | |
| attr_reader :css | |
| attr_reader :parser, :build_handler, :root_node | |
| def initialize(less) | |
| @less = less.dup | |
| @parser = LessGrammarParser.new | |
| @build_handler = BuildHandler.new | |
| parse |
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
| require 'rubygems' | |
| require 'active_record' | |
| ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:") | |
| silence_stream(STDOUT) do | |
| ActiveRecord::Schema.define do | |
| create_table(:posts) {|t| t.string :title } | |
| create_table(:comments) {|t| t.integer :post_id; t.string :comment } | |
| 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
| <%= render :partial => "entry_big", :object => @entries.first %> | |
| <%= render :partial => "entry_small", :collection => @entries[1..-1] %> |
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
| # Include this module into the controllers you want to easy-mode CRUD | |
| module AdminControllerCrudActions | |
| COLUMN_MAP = { | |
| :string => :text_field, | |
| :text => :text_area, | |
| :integer => :text_field, | |
| :datetime => :datetime_select | |
| } | |
| def index |
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
| #!/usr/bin/env ruby | |
| # Just testing. Will create new gist when I worked out the kinks. |
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 PathResolverController < ApplicationController | |
| def resolve | |
| name = PagePath.find_by_name(params[:path].join('/')).controller_name | |
| case name | |
| when "this" | |
| some_logic | |
| when "than" | |
| other_logic | |
| else |
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
| git "git://github.com/rails/arel.git" | |
| git "git://github.com/rails/rack.git" | |
| gem "rails", :git => "git://github.com/rails/rails.git" |
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
| anon_class = Class.new | |
| p anon_class.name | |
| # => "" | |
| subanon_class = Class.new(anon_class) | |
| p subanon_class.ancestors | |
| # => [#<Class:0x100a54578>, #<Class:0x100a54618>, Object, Kernel] | |
| NoLongerAnon = anon_class | |
| TheSubclass = subanon_class |