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 requirable?(filename) | |
result = fork do | |
begin | |
require filename | |
exit!(0) | |
rescue | |
exit!(1) | |
end | |
end | |
result == 0 ? true : false |
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
if v:progname =~? "evim" | |
finish | |
endif | |
"core vim options {{{1 | |
" Use Vim settings, rather then Vi settings (much better!). | |
" This must be first, because it changes other options as a side effect. | |
set nocompatible | |
" allow backspacing over everything in insert mode |
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 'rubygems' | |
require 'dm-core' | |
require 'pp' | |
DataMapper.setup(:default, "sqlite3::memory:") | |
class City | |
include DataMapper::Resource | |
property :id, Serial |
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 DateTime | |
def httpdate | |
t = dup.utc | |
sprintf('%s, %02d %s %d %02d:%02d:%02d GMT', | |
Time::RFC2822_DAY_NAME[t.wday], | |
t.day, Time::RFC2822_MONTH_NAME[t.mon-1], t.year, | |
t.hour, t.min, t.sec) | |
end | |
def utc |
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
diff --git a/lib/rubygems.rb b/lib/rubygems.rb | |
index 458a845..13994d4 100644 | |
--- a/lib/rubygems.rb | |
+++ b/lib/rubygems.rb | |
@@ -121,6 +121,8 @@ module Gem | |
# Gem::Requirement and Gem::Version documentation. | |
def self.activate(gem, *version_requirements) | |
+ options = version_requirements.last.is_a?(Hash) ? version_requirements.pop : {} | |
+ sources = options[:sources] || [] |
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
describe "Without logging in" do | |
describe "a request to /foo/bar" do | |
before(:each) do | |
get("/foo/bar") | |
end | |
it "redirects" do | |
rack.status.should == 302 | |
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
diff --git a/lib/rubygems.rb b/lib/rubygems.rb | |
index 458a845..bc0078f 100644 | |
--- a/lib/rubygems.rb | |
+++ b/lib/rubygems.rb | |
@@ -121,6 +123,8 @@ module Gem | |
# Gem::Requirement and Gem::Version documentation. | |
def self.activate(gem, *version_requirements) | |
+ options = version_requirements.last.is_a?(Hash) ? version_requirements.pop : {} | |
+ sources = options[:sources] || [] |
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
main = "jf*2r112r2" | |
f1 = "22r" | |
f2 = "ff*" | |
f1.gsub!(/2/, f2) | |
f2.gsub!(/1/, f1) | |
main.gsub!(/1/, f1) | |
main.gsub!(/2/, f2) | |
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
>> a = "foo" | |
=> "foo" | |
>> b = "bar" | |
=> "bar" | |
>> c = {} | |
=> {} | |
>> c[a] ||= :foo | |
=> :foo | |
>> c[b] ||= :bar | |
=> :bar |
OlderNewer