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 ActionController::TestCase | |
| # setup :mock_warden | |
| teardown :cleanup_warden_env | |
| def warden | |
| @_warden ||= mock | |
| end | |
| def mock_warden_for(*scopes) | |
| scopes.each do |scope| |
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 String | |
| def /(rhs) | |
| concat(File::SEPARATOR + rhs) | |
| end | |
| end | |
| "foo" / "bar" / "baz" # => "foo/bar/baz" |
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 | |
| # Simple migration navigator for terminal. | |
| # | |
| # Install | |
| # 1) Throw this code into script/migrator | |
| # 2) chmod +x script/migrator | |
| # | |
| # Use | |
| # script/migrator => show 10 latest migrations, choose one |
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 'test/unit' | |
| ## | |
| # Variant generator returns all possible combinations of elements of all given arrays. | |
| # Running this gist will run the tests. For normal usage, simply copy VariantsGenerator module. | |
| module VariantsGenerator | |
| module_function | |
| ## | |
| # Operates on arrays. |
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 | |
| # Open RP Song | |
| # | |
| # Opens currently playing Radio Paradise song in the default browser. | |
| # | |
| # Example usage: | |
| # - download to ~/scripts | |
| # - chmod +x open_rp_song.rb | |
| # - in QuickSilver add a hotkey trigger to run this file (i used ctrl+cmd+r) |
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 | |
| # INSTALL | |
| # Put the script somewhere where PATH points, then do | |
| # % chmod +x /path/to/this/script/sfv | |
| # USAGE | |
| # % cd /dir/with/sfv/file | |
| # % sfv |
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 Test | |
| class << self | |
| def metaclass | |
| class << self; self end | |
| end | |
| def set_c_in_metaclass | |
| metaclass.class_eval do | |
| @@c = 11 | |
| 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 Foo | |
| @@a = "foo" | |
| def self.get_a | |
| @@a | |
| end | |
| end | |
| class Bar < Foo | |
| @@a = "bar" |
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 'wpxml_parser' | |
| require 'nanoc3' | |
| require 'fileutils' | |
| XML_PATH = 'data.xml' | |
| NANOC_PATH = '.' | |
| class WordpressNanocImporter | |
| include WpxmlParser |
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
| passenger nginx rails bundler status error | |
| 2.2.5 0.8.22 2.3.5 no OK | |
| 2.2.5 0.8.22 2.3.9 yes FAIL passenger not finding gems | |
| 2.2.5 0.8.50 2.3.9 yes FAIL couldn't compile | |
| 2.2.12 0.8.50 2.3.9 yes FAIL passenger not finding gems | |
| 2.2.13 0.8.50 2.3.9 yes FAIL PassengerHelper not starting | |
| 2.2.15 0.7.67 2.3.9 yes FAIL PassengerHelper not starting | |
| 2.2.15 0.8.50 2.3.9 yes FAIL PassengerHelper not starting | |
| 3.0.0.pre3 0.8.50 2.3.9 yes OK (requires libcurl4-openssl-dev) |