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 RexmlExtender | |
def better() 'yer mom'; end | |
... | |
end | |
class Rexml | |
include RexmlExtender | |
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
module TestCaseExtensions | |
def should(testname, &block) | |
unless block_given? | |
pending = 'PENDING ' | |
block = lambda {} | |
end | |
testname = "test #{pending}#{@focus}should #{testname}".gsub(/\s(no|not)\s/i, ' *\1* ') | |
define_method(testname, block) | |
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
#!/usr/bin/ruby -w | |
class QuoteCleaner | |
module ClassMethods | |
LEFT_SINGLE_SMARTQUOTE = /\342\200\230/ | |
RIGHT_SINGLE_SMARTQUOTE = /\342\200\231/ | |
SINGLE_SMARTQUOTES = Regexp.union(LEFT_SINGLE_SMARTQUOTE, RIGHT_SINGLE_SMARTQUOTE) | |
LEFT_DOUBLE_SMARTQUOTE = /\342\200\234/ | |
RIGHT_DOUBLE_SMARTQUOTE = /\342\200\235/ | |
DOUBLE_SMARTQUOTES = Regexp.union(LEFT_DOUBLE_SMARTQUOTE, RIGHT_DOUBLE_SMARTQUOTE) |
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
Autotest.send(:alias_method, :real_find_files, :find_files) | |
Autotest.send(:define_method, :find_files) do |*args| | |
real_find_files.reject do |k, v| | |
if (ENV['AUTOLIMIT'] and !ENV['AUTOLIMIT'].empty?) | |
!Regexp.new(ENV['AUTOLIMIT']).match(k) | |
end | |
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
#!/usr/bin/env ruby -w | |
require 'yaml' | |
users = YAML::load(File.open(File.join(File.expand_path('~/'), '.twitrc'), 'r')) | |
user = users.find {|u| u[:name] == ARGV[0]} | |
if (not user.empty?) | |
post = ARGV[1..-1].join(' ') | |
bark = %[curl -u #{user[:name]}:'#{user[:password]}' -d status="#{post}" http://twitter.com/statuses/update.json] |
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
[barnekr@saturnino:~]$ ruby -v | |
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] | |
[barnekr@saturnino:~]$ echo '1.3' |irb | |
>> 1.3 | |
=> 1.3 |
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 'open-uri' | |
# url dsl -- the ultimate url dsl! | |
# | |
# You just can't beat this: | |
# | |
# $ irb -r url_dsl | |
# >> include URLDSL | |
# => Object | |
# >> http://github.com/defunkt.json |
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 -w | |
=begin | |
cont: #HBHhourlyView | |
hour: #HBHhourlyView .textsmallbold | |
temp: .textsmall:nth-child(4) | |
desc: .textsmall:nth-child(5) | |
=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
#!/usr/bin/env ruby | |
require 'gmail' | |
unless ENV['GMAIL_USERNAME'] && ENV['GMAIL_PASSWORD'] | |
raise StandardError, <<-INFO | |
Please create a ~/.gmail_keys file with the following: | |
export GMAIL_USERNAME='username' | |
export GMAIL_PASSWORD='password' |
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
This is basically a dirty hack :) I have no idea if messing with the default OSX apache config this way is frowned upon. My view is that it works now, and if it breaks I'll fix it. | |
Add any domains you want to blacklist to /etc/hosts, pointing at 127.0.0.1. You need to enable web sharing to get apache running of course. | |
Changes to the default /etc/apache2/httpd.conf | |
============================================== | |
Listen 127.0.0.1:80 # so that the world can't see the list | |
DocumentRoot "/Library/WebServer/Documents/public" # to fit in with passenger, you need to create the public dir (and maybe /tmp too) |