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
def self.statuses | |
Order.all.collect{|x| x.status}.uniq | |
end | |
# Currently : STATUSES = ["SHIPPED", "PROCESSING", "RECEIVED", "INCOMPLETE", "VOIDED", "REFUNDED", "FRAUDULENT", "ON HOLD"] | |
validates_inclusion_of :status, :in => statuses | |
statuses.map{|x| x.downcase.gsub(" ", "_")}.each { |s| named_scope s, :conditions => { :status => s } } | |
### JOSH PREFERS | |
named_scope :with_status, lambda{|s| { :conditions => { :status => s } } } |
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
# Perhaps this | |
def run | |
last_id = CatProduct.find(:all, :limit => 1, :order => 'id DESC').first.id | |
last_id_run = 0 | |
num = 0 | |
while(last_id_run < last_id) do | |
this_batch = CatProduct.find(:all, :limit => 100, :offset => num, :order => 'id ASC') | |
GC.start | |
this_batch.each do |cp| |
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
--($:~/work/subtle)-- hg diff -g Rakefile | |
diff --git a/Rakefile b/Rakefile | |
--- a/Rakefile | |
+++ b/Rakefile | |
@@ -20,15 +20,17 @@ | |
# | |
# Options / defines {{{ | |
@options = { | |
- "destdir" => "", | |
- "prefix" => "/usr", |
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
function ScoreNetwork(score) | |
{ | |
var self = this; | |
self.ws = null; | |
self.data = null; | |
self.score = score; | |
self.net = self; | |
self.initialize = function() | |
{ |
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
asdf" asdfasdf " | |
odfas | |
asdfas | |
>> FasterCSV.parse(s.gsub(/"/, '\"')) | |
FasterCSV::MalformedCSVError: Illegal quoting on line 1. | |
from /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1650:in `shift' | |
from /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1568:in `loop' | |
from /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1568:in `shift' | |
from /opt/local/lib/ruby/gems/1.8/gems/fastercsv-1.4.0/lib/faster_csv.rb:1513:in `each' |
NewerOlder