LOL
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
class EmailCollection | |
include Enumerable | |
delegate :each, :to => :email_addresses | |
def initialize(raw_email_addresses) | |
@raw_email_addresses = raw_email_addresses | |
end | |
def valid_emails | |
select {|e| e.match(email_regex) } |
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
class Email | |
def initialize(address) | |
@address = address | |
end | |
def address | |
@address.strip | |
end |
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
class Particpant < AR::Base | |
delegate :require_name?, :require_email?, :require_phone?, :to => :project, :allow_nil => true | |
with_options :on => :update do | |
validates_presence_of :name, :if => :require_name? | |
validates_presence_of :email, :if => :require_email? | |
validates_presence_of :phone, :if => :require_phone? | |
end | |
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 find_suggestions_for(restaurant) | |
past_orders = [] | |
orders.each {|o| past_orders << o if o.restaurant == restaurant } | |
past_orders | |
end | |
def find_suggestions_for(restaurant) | |
orders.inject([]) do |result, order| | |
result << order if order.restaurant == restaurant |
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
class Breadcrumb | |
include ActionView::Helpers::TagHelper | |
def initialize | |
@crumbs = [] | |
end | |
def append(name, link) | |
@crumbs << Breadcrumb::Crumb.new(name, link) | |
end |
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
class Family < ActiveRecord::Base | |
def self.with_discontinued_accessories | |
joins(:products).where({ | |
:products => { | |
:accessory => true, | |
:production_status => 'discontinued', | |
:active => true, | |
:parent_id => nil | |
} |
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
# module: audit2 | |
class Audit < Thor | |
desc "all", "Run all audit tasks" | |
def all | |
%w(architecture database stats tests coverage flog roodi filesize queries).each do |task| | |
log "\n*** reviewing #{task}", true | |
log `thor audit:#{task}`, true | |
end | |
end |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/atom10full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/"CkIASHw9cSp7ImA9WxdaGEg.""><id>tag:blogger.com,1999:blog-6867964</id><updated>2008-08-27T11:22:29.269-04:00</updated><title>idiosyncranomicon</title><subtitle type="html" /><link rel="alternate" type="text/html" href="http://idiosyncranomicon.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/6867964/posts/default?start-index=26&max-results=25&redirect=false&v=2" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://idiosyncranomicon.blogspot.com/feeds/posts/default" /><author><name>Kevin</name><ema |
NewerOlder