My Recent Pastes (49 and counting)

Pastes by evn (49 and counting)

Below are the 15 most recent pasties by evn.

April 24, 2007
12:23AM EDT
by evn

 _________
< Frames! >
 ---------
        \   ^__^
         \  (oo)\_______

April 23, 2007
11:19PM EDT
by evn

#BEGIN CONFIG INFO
#DESCR: 1GB RAM, InnoDB only, limited ACID, few connections, heavy queries
#TYPE: SYSTEM
#AUTHOR: Evan Weaver
#END CONFIG INFO

April 23, 2007
11:06PM EDT
by evn

             total       used       free     shared    buffers     cached
Mem:          1022        978         44          0         18         31
-/+ buffers/cache:        928         94
Swap:         2047        991       1056

April 23, 2007
12:37AM EDT
by evn

HasManyThroughAssociation has a performance problem where push and <<, etc., trigger a gratuitous load of the @target association. This is very punishing on a large association collection.

Part of the issue is that HasManyThroughAssociation#method_missing indirectly forces load_target to run, loading the association. This means that returning(), require, etc., and other valid methods not local to the class trigger object state change and database loads. The attached patch avoids calling returning() for this reason.

April 23, 2007
12:12AM EDT
by evn

Index: activerecord/test/associations_test.rb
===================================================================
--- activerecord/test/associations_test.rb        (revision 6549)
+++ activerecord/test/associations_test.rb        (working copy)
@@ -7,6 +7,7 @@

April 19, 2007
8:44PM EDT
by evn

class Object
  def _logger_debug s
    ::ActiveRecord::Base.logger.debug(s) if ::ActiveRecord::Base.logger
  end  
  def _logger_warn s

April 19, 2007
3:28AM EDT
by evn

class HpricotMock

  def initialize title, *args
    @title = title

April 16, 2007
1:55AM EDT
by evn

module Kindling
  
  mattr_accessor :before_filters
  mattr_accessor :after_filters
  self.before_filters ||= []

April 16, 2007
1:46AM EDT
by evn

module Kindling
  
  mattr_accessor :before_filters
  mattr_accessor :after_filters
  self.before_filters ||= []

April 12, 2007
3:10PM EDT
by evn

$ script/console 
Loading development environment.
>> Topic.find(324343).user.class == User
=> true
>> reload!

April 05, 2007
10:16PM EDT
by evn

#BEGIN CONFIG INFO
#DESCR: 2GB RAM, InnoDB only, limited ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO

April 05, 2007
2:22PM EDT
by evn

## redefine task

# http://www.bigbold.com/snippets/posts/show/2032
module Rake

March 30, 2007
7:34AM EDT
by evn

## task.rb

class Task < ActiveRecord:Base
  belongs_to :product
  belongs_to :shop

March 29, 2007
11:38AM EDT
by evn

## Models

class Photo < ActiveRecord::Base
  has_many_polymorphs :attachables, 
    :from => [:galleries, :notes], 

March 28, 2007
6:38PM EDT
by evn

chloe:~/projects/miscellaneous/cookbook eweaver$ script/console 
Loading development environment.
>> Tag
=> Tag
>> Recipe.find_by_title("freezepop").taggers << Tag.create(:name => "ice")

Next page

Previous page