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
class BrowsePage | |
attr_reader :collection | |
def initialize(collection) | |
@collection = collection | |
end | |
def method_missing(method, *args, &block) | |
@collection.send method, *args, &block | |
end |
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
def self.columns | |
ignored_columns = ["state_changed"] | |
super.delete_if { |column| ignored_columns.include?(column.name) } | |
end |
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
class ExpiringMemoryStore < ActiveSupport::Cache::MemoryStore | |
def read(name, options = nil) | |
out = super(name, options) | |
return if out.nil? | |
return if out.first && out.first < Time.now | |
return out.last | |
end | |
def write(name, value, options = {}) |
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
class BlackHoleStore < ActiveSupport::Cache::MemoryStore | |
def write(*args) | |
end | |
end |
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
def wait_for_server | |
time_out_at = Time.now + 30.seconds | |
loop do | |
raise "Server didn't start after 30 seconds" if Time.now > time_out_at | |
begin | |
open 'http://localhost:2000/' | |
return | |
rescue Errno::ECONNREFUSED, Errno::ECONNRESET | |
end |
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
To use RubyMine, RVM (Ruby Version Manager) and REE (Ruby Enterprise Edition) on Snow Leopard, I had to: | |
sudo ln -s /Users/yourname/.rvm/ruby-enterprise-1.8.6-20090610 /opt/ | |
Then, in RubyMine Preferences, select Ruby SDK and Gems, Add SDK... and choose /opt/ruby-enterprise-1.8.6-20090610/bin/ruby | |
And put this into ~/.MacOSX/environment.plist. Then log out and log back in. | |
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
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
yum install curl-devel krb5-devel e2fsprogs-devel libidn-devel openssl-devel zlib-devel | |
# http://groups.google.com/group/curb---ruby-libcurl-bindings/browse_thread/thread/cb50d150424b4fe5 |
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
class PidFile | |
attr_reader :path | |
def initialize(path) | |
@path = path | |
end | |
def write | |
file = File.open(@path, "w") | |
file << Process.pid |
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
var TRACK_URL = 'http://www.google-analytics.com/ga.js'; | |
var TRACK_TRIES = 0; | |
function Monitor() { | |
if ("_gat" in window) { | |
window.clearInterval(Monitor.INTERVAL); | |
Monitor.INTERVAL = null; | |
var A = _gat._getTracker("UA-176427-3"); | |
A._initData(); | |
A._trackPageview() |
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
def stylesheet_cdata_section(content) | |
"\n/*#{cdata_section("*/\n#{content}\n/*")}*/\n" | |
end |
OlderNewer