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
# handy trick for keeping your AR models more manageable | |
# see http://m.onkey.org/2008/9/15/active-record-tips-and-tricks for info | |
class << ActiveRecord::Base | |
def concerned_with(*concerns) | |
concerns.each do |concern| | |
require_dependency "#{name.underscore}/#{concern}" | |
end | |
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
# Mongrel | |
# • Current version: 1.1.5-java | |
# • Still has request mutex; manually | |
# remove for better throughput | |
# in $JRUBY/lib/ruby/gems/1.8/gems/mongrel-1.1.5-java/lib/mongrel/rails.rb | |
# @guard.synchronize { | |
@active_request_path = request.params[Mongrel::Const::PATH_INFO] | |
Dispatcher.dispatch(cgi, ActionController::CgiRequest::...) | |
@active_request_path = nil | |
# } |
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
#!/usr/bin/env ruby | |
# To install: | |
# sudo gem sources -a http://gems.github.com # (if needed) | |
# sudo gem install hayesdavis-grackle | |
# see http://github.com/hayesdavis/grackle for more info | |
# To run: | |
# Set USER and PASS for the account you want to clean. | |
# ./whack_statuses.rb |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'json' | |
raise "you fail at this" if !ARGV[0] | |
data="" | |
File.open(ARGV[0]).each_line do |line| | |
data << line | |
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 whack(objects) | |
result = {} | |
objects.each do |o| | |
result[o.send("table_name")] = o.send("delete_all") | |
end | |
result | |
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
$ curl "http://www.flickr.com/services/oembed/?url=http://flickr.com/photos/digitalnomad/3086168632/" | |
<?xml version="1.0" encoding="utf-8" standalone="yes"?> | |
<oembed> | |
<version>1.0</version> | |
<type>video</type> | |
<title>flickr mobile video test, please ignore</title> | |
<author_name>digitalnomad</author_name> | |
<author_url>http://www.flickr.com/photos/digitalnomad/</author_url> | |
<cache_age>3600</cache_age> | |
<provider_name>Flickr</provider_name> |
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 'blog' | |
require 'thin' | |
require 'rack_fix' | |
run Rack::Adapter::Camping.new(Blog) | |
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
# TableSplitter splits record ids up into ranges to use in SQL | |
#!/usr/bin/env ruby | |
require File.dirname(__FILE__) + '/../config/environment' | |
# $ ./splitter.rb 5 2 | |
# break into 5 chunks. | |
# requesting chunk 2: id >= 74 and id < 144 | |
# For demo purposes, here are all of them: | |
# requesting chunk 1: id >= 1 and id < 74 |
NewerOlder