class Array
def count_by
inject( Hash.new(0) ) do |result, val|
...
Ruby On Array.group_by that counts
by arvanasse,
June 30, 2010 13:55
def twitter_message ls = LineStream.new(true) ...
Ruby On Checking validity of messag...
by arvanasse,
June 30, 2010 13:41
Really like the way spaghet...
class Rule < ActiveRecord::Base RULE_TYPES = [:allowed_senders, :blocked_senders, :blocked_character_set, :custom] end ...
Ruby On Rails helper method needs r...
by arvanasse,
June 30, 2010 13:19
#inject is the best way to ...
class Rule < ActiveRecord::Base RULE_TYPES = [:allowed_senders, :blocked_senders, :blocked_character_set, :custom] end ...
Ruby On Rails helper method needs r...
by arvanasse,
June 30, 2010 13:18
#inject is the best way to ...
Challenger < ActiveRecord::Base has_many :challenges, :class_name => 'Fight', :foreign_key => :challenger_id has_many :defenses, :class_name => 'Fight', :foreign_key => :challengee_id ...
Ruby On Refactor sanitize_sql_array
by arvanasse,
June 21, 2010 16:17
Why not replace #challenger...
class Store < ActiveRecord::Base has_many :promos ...
Ruby On Rails Store has more than m...
by arvanasse,
June 08, 2010 14:51
Your code does not seem to ...
# Assuming something like this class Badge BRONZE_BADGE 10 ...
Ruby On how to refactor tricky logi...
by arvanasse,
June 07, 2010 14:20
Assuming that you call #che...
def array_to_params(param_name, params) # normalize to an array first params = [params] unless params.is_a?(Array) ...
Ruby On Generate post query for array
by arvanasse,
June 01, 2010 15:03
This refactoring does not p...
require 'date' # Creating this array in the correct order allows you to use the index as the suggested value. ...
Ruby On Simple Ruby Program for cre...
by arvanasse,
June 01, 2010 14:42
Not a bad first attempt. I...
text = "75 95 64 ...
Ruby On I'm having trouble thinking...
by arvanasse,
May 25, 2010 15:56
The 'row.length == 1' test ...
text = "75 95 64 ...
Ruby On I'm having trouble thinking...
by arvanasse,
May 25, 2010 15:42
Here's a first cut just mak...
list = lists.collect do |list|
search(str, list).reject{|s| ignored(s.text)}.collect{|s| { :name=> "#{s.text}", :url => "#{s.url}" } }
end.flatten

Pretty similar to spaghetti...