Skip to content

Instantly share code, notes, and snippets.

View stephenjudkins's full-sized avatar

Stephen Judkins stephenjudkins

View GitHub Profile
>> 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
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`)
module Enumerable
def permutations
Enumerable::Enumerator.new(self, :each_permutation)
end
def each_permutation
each do |item|
others = select {|other| item != other}
>> 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
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
ruby-1.9.2-p0 > t = Time.now
=> 2010-10-27 17:41:00 -0700
ruby-1.9.2-p0 > t.utc?
=> false
ruby-1.9.2-p0 > t2 = t.utc
=> 2010-10-28 00:41:00 UTC
ruby-1.9.2-p0 > t
=> 2010-10-28 00:41:00 UTC
ruby-1.9.2-p0 > t.object_id
=> 2154182900
Around do |scenario, block|
RSpec::Mocks.setup(self)
RSpec::Mocks.teardown
block.call
RSpec::Mocks.verify
end
2010-12-23 15:11:50.204:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2010-12-23 15:11:50.297:INFO::jetty-6.1.26
-> builtin/core_ext/symbol
<- builtin/core_ext/symbol - 449ms
-> enumerator
<- enumerator - 39ms
-> java
-> java
<- java - 0ms
-> builtin/javasupport/java
require 'java'
module Java::scala::collection::Seq
def each(&block)
foreach &block
end
include Enumerable
end
import annotation.tailrec
object SplitList {
def split[A](all: List[A], f: (A, A) => Boolean): List[List[A]] = {
@tailrec def _split(list: List[A], acc: List[List[A]], current: List[A]): List[List[A]] = list match {
case Nil => current match {
case Nil => Nil
case _ => acc ::: current :: Nil
}