Skip to content

Instantly share code, notes, and snippets.

View stephenjudkins's full-sized avatar

Stephen Judkins stephenjudkins

View GitHub Profile
Ivan-IV:compost stephen$ rake test
(in /www/aboutus/compostus/compost)
/www/bin/ruby -Ilib:test "/www/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake/rake_test_loader.rb" "test/unit/about_us_mailer_test.rb" "test/unit/account_activity_test.rb" "test/unit/action_test.rb" "test/unit/action_utility_test.rb" "test/unit/address_intersector_test.rb" "test/unit/adult_filter_test.rb" "test/unit/analytics_robot_test.rb" "test/unit/archive_test.rb" "test/unit/array_test.rb" "test/unit/au_diff_test.rb" "test/unit/au_page_lookup_test.rb" "test/unit/bot_filter_test.rb" "test/unit/compost_image_test.rb" "test/unit/contact_test.rb" "test/unit/create_account_actions_test.rb" "test/unit/daily_action_count_edits_test.rb" "test/unit/daily_action_count_reg_and_email_test.rb" "test/unit/edit_mailer_test.rb" "test/unit/edit_summary_parser_test.rb" "test/unit/edit_test.rb" "test/unit/exclusion_list_test.rb" "test/unit/external_link_test.rb" "test/unit/form_test.rb" "test/unit/geo_cache_test.rb" "test/unit/graphic_protection_test.rb" "te
>> Page.find_by_title('OnlineFreeSpanish.com').tag_collection.tags
=> [{"score"=>50, "keyword"=>"accustomed"}, {"score"=>50, "keyword"=>"acquiring"}, {"score"=>50, "keyword"=>"activity"}, {"score"=>50, "keyword"=>"age"}, {"score"=>50, "keyword"=>"anyone"}, {"score"=>50, "keyword"=>"anything"}, {"score"=>50, "keyword"=>"approach"}, {"score"=>50, "keyword"=>"area"}, {"score"=>50, "keyword"=>"attend"}, {"score"=>50, "keyword"=>"basic"}, {"score"=>50, "keyword"=>"become"}, {"score"=>50, "keyword"=>"both"}, {"score"=>50, "keyword"=>"brain"}, {"score"=>50, "keyword"=>"busines"}, {"score"=>50, "keyword"=>"catch"}, {"score"=>50, "keyword"=>"check"}, {"score"=>50, "keyword"=>"child"}, {"score"=>50, "keyword"=>"created"}, {"score"=>50, "keyword"=>"credit"}, {"score"=>50, "keyword"=>"designed"}, {"score"=>50, "keyword"=>"different"}, {"score"=>50, "keyword"=>"doesn"}, {"score"=>50, "keyword"=>"early"}, {"score"=>50, "keyword"=>"education"}, {"score"=>50, "keyword"=>"educational"}, {"score"=>50, "keyword"=>"engage"}, {"s
module Enumerable
def permutations
Enumerable::Enumerator.new(self, :each_permutation)
end
def each_permutation
each do |item|
others = select {|other| item != other}
CREATE TABLE `lists` (
`id` int(11) NOT NULL auto_increment,
`uid` varchar(255) NOT NULL,
`casespace_key` text,
`created_at` datetime default NULL,
`updated_at` datetime default NULL,
`title` varchar(255) default NULL,
`description` text,
PRIMARY KEY (`id`),
UNIQUE KEY `index_lists_on_uid` (`uid`)
>> ids = [25859692, 25859705, 25859728, 25859747, 25859763, 25859767, 25859788, 25859789, 25859802, 25859813, 25859819, 25859827, 25859828, 25859830, 25859838, 25859844, 25859856, 25859857, 25859874, 25859904, 25859969, 25859999, 25860016, 25860028, 25860034, 25860040, 25860048, 25860049, 25860067, 25860139, 25860143, 25860146, 25860147, 25860149, 25860162, 25860164, 25860174, 25860178, 25860182, 25860190, 25860197, 25860201, 25860209, 25860215, 25860246, 25860251, 25860270, 25860276, 25860307, 25860319, 25860326, 25860336, 25860337, 25860352, 25860358, 25860372, 25860380, 25860383, 25860385, 25860401, 25860404, 25860414, 25860418, 25860421, 25860422, 25860433, 25860437, 25860451, 25860464, 25860466, 25860470, 25860484, 25860486, 25860499, 25860516, 25860528, 25860532, 25860541, 25860552, 25860554, 25860560, 25860587, 25860592, 25860605, 25860612, 25860616, 25860620, 25860634, 25860637, 25860648, 25860655, 25860702, 25860738, 25860796]
>> actions = Action.all :conditions => {:id => ids}
>> times = actions.c
jruby --fast --server -J-Djruby.objectspace.enabled=false -J-Xmx1024m -J-Xms1024m -J-Xmn512m
location /Special/graphic_protection {
proxy_intercept_errors on;
rewrite ^/Special/graphic_protection/(.*)$ /$1 break;
proxy_pass http://au-graphic-protection.s3.amazonaws.com;
error_page 404 = $uri;
}
@stephenjudkins
stephenjudkins / gist:116269
Created May 22, 2009 17:56
the most beautiful ruby code ever produced.
MW_PARSER_VERSION = "1.6.1"
RLH_FOR_UPDATE = 1
OT_HTML = 1
OT_WIKI = 2
OT_MSG = 3
OT_PREPROCESS = 4
SFH_NO_HASH = 1
STRIP_COMMENTS = "HTMLCommentStrip"
HTTP_PROTOCOLS = "http:\\/\\/|https:\\/\\/"
EXT_LINK_URL_CLASS = "[^][<>\"\\x00-\\x20\\x7F]"
def self.group_by(method_name)
define_method :"group_by_#{method_name}" do
inject([]) do |_, v|
k = yield(v)
if _.empty? || !_.last.send(method_name, k)
_ << [v]
else
_.last << v
end
_
require 'electric_sheep/whois/parser_wrapper'
require 'dm_test'
class Contact
include DataMapper::Resource
property :page_id, Integer, :key => true
property :address, String
property :city, String
property :state, String