Skip to content

Instantly share code, notes, and snippets.

View maxim's full-sized avatar
🛠️

Max Chernyak maxim

🛠️
View GitHub Profile
class ActionController::TestCase
# setup :mock_warden
teardown :cleanup_warden_env
def warden
@_warden ||= mock
end
def mock_warden_for(*scopes)
scopes.each do |scope|
class String
def /(rhs)
concat(File::SEPARATOR + rhs)
end
end
"foo" / "bar" / "baz" # => "foo/bar/baz"
@maxim
maxim / migrator
Created February 7, 2010 09:08
script/migrator for easier navigation of migrations
#!/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
@maxim
maxim / variants_generator.rb
Created March 9, 2010 03:52
VariantGenerator
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.
#!/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)
#!/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
class Test
class << self
def metaclass
class << self; self end
end
def set_c_in_metaclass
metaclass.class_eval do
@@c = 11
end
class Foo
@@a = "foo"
def self.get_a
@@a
end
end
class Bar < Foo
@@a = "bar"
require 'rubygems'
require 'wpxml_parser'
require 'nanoc3'
require 'fileutils'
XML_PATH = 'data.xml'
NANOC_PATH = '.'
class WordpressNanocImporter
include WpxmlParser
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)