class Company has_many :stores end ...
Ruby Active Record getting uniqu...
by kibyegn.myopenid.com,
February 03, 2012 01:40,
1 refactoring, tagged with rails, short clean ruby, active record
layouts = Dir.glob("_layouts/*")
layouts.each do |layout|
layout.gsub!(/^_layouts\/(.*)\..*$/, '\1')
...
Ruby List the files in a directo...
The title says it all, I'm ...
Weeks = [["2012-01-15","2012-01-22"], ["2012-01-22","2012-01-29"], ["2012-01-29","2012-02-05"],["2012-02-05","2012-02-12"], ["2012-02-12","2012-02-19"], ["2012-02-19","2012-02-26"]] ...
Ruby clean the code
by https://www.google.com/accounts/o8/id?id=AItOawlaTnwjQ00W1XCRaUEGIonvKgruTMebfak,
January 30, 2012 03:54,
4 refactorings, tagged with ruby, rails 3
Plz help me clean the code
...
M = [["a", "b"], ["c", "d"], ["e", "f"]] x = [] ...
Ruby Array parsing in a block
by https://www.google.com/accounts/o8/id?id=AItOawmWMRp7fAci9domcwhxD3fNikoTak9bkYc,
January 26, 2012 05:59,
1 refactoring, tagged with arrays, blocks, loops, array syntax
x should be ["a","c","e"] i...
if $0 == __FILE__
total = 0
...
Ruby Euler Problem 2 solution
by https://www.google.com/accounts/o8/id?id=AItOawkD4xFlDWBQgag82x1DXUSXIYd_s8Ca8B4,
January 24, 2012 18:43,
3 refactorings
Sorry if I shouldn't be pos...
When /^I request test urls with headers "([^"]*)" "([^"]*)"$/ do |accept, headers|
header_map = create_header_map_from_string(headers)
test_urls = load_fixture("test-urls1.txt")
...
Ruby Looping over a file
by https://www.google.com/accounts/o8/id?id=AItOawnvtFGh-r9ibK5ZHTYiZh2UzxDww7-bwI0,
January 11, 2012 09:15,
1 refactoring
The puts doesn't happen unt...
# Start of file, showing the name of the application # Size, and all relevent parts of the title ...
Ruby Address Book
by https://www.google.com/accounts/o8/id?id=AItOawkiJON4MFJ9bopD8IvwQ1pbpH3ag7yrtnI,
December 28, 2011 07:36,
5 refactorings, tagged with ruby, methods, regexp, regular expression
This is a fairly simple add...
ALPHA = ('a'..'z').to_a
def nextAlpha letter
...
Ruby String Incrementing
by caustic-interface.myopenid.com,
December 20, 2011 18:24,
11 refactorings
It's intended to increment ...
def battle # do something if result=self.save ...
Ruby Unnecessary assignment near...
by https://www.google.com/accounts/o8/id?id=AItOawldXGtOvAVQC5k5Z7Y71zO75UzIQ98K5a0,
December 12, 2011 07:36,
5 refactorings, tagged with return, observers
It feels like the assignmen...
>> %w(Pending Processing Executed Canceled).each_with_index.map {|v, i| i}
=> [0, 1, 2, 3]
Ruby Get array of indexes from g...
Using it :in validates_incl...
def self.generate_required_data(orders)
all_the_orders = []
orders.each do |order|
...
Ruby Building an array from data...
Just interested to see how ...
#more elegante way? sector = Sector.create(:name => name) unless sector = Sector.find_by_name(sector)
Ruby more elegant way
no ideas about it, rails 3....
@topic = if (defined? @parent.topic) then
@parent.topic
else
...
Ruby Ugly ruby if statement.
I know there has to be a be...
#MM-YYYY
"2011-10".split("-").reverse.join("/") => "10/2011"
Ruby parsing date
anyone has the better solut...
Top Selling SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne products that cure & prevent acne, whiteheads, blackheads and oily skin. http://www.skinb5.com/order.asp
Ruby Best Acne Products
by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw,
November 12, 2011 03:18,
No refactoring, tagged with Best Acne Product, Best Acne Treatment, Best Acne Cure
Top Selling SkinB5 Acne Tre...
Best Seller SkinB5 Acne Treatment! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne products that cures & prevents acne, whiteheads, blackheads and oily skin. http://www.skinb5.com/acne-products.asp
Ruby Acne Products, Acne Product
by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw,
November 12, 2011 03:17,
6 refactorings, tagged with Acne Product, Acne Products, Body Acne
Best Seller SkinB5 Acne Tre...
Top Selling SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalises skin oil production. Best natural acne products that cures & prevents acne, whiteheads, blackheads and oily skin. http://www.skinb5.com/natural-acne-treatment.asp
Ruby Natural Acne Treatment, Nat...
by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw,
November 12, 2011 03:16,
No refactoring, tagged with Acne Treatment, Natural Acne Treatment, Treatment for Acne
Top Selling SkinB5 Acne Tre...
Top Seller SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalises skin oil production. Best natural acne products that cures & prevents acne,whiteheads, blackheads and oily skin.
Ruby Treatment for Acne, Best Ac...
by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw,
November 12, 2011 03:12,
No refactoring, tagged with Acne Product, Acne Treatment, Acne Treatments
Top Seller SkinB5 Acne Trea...
Proven Top Seller SkinB5 Acne Treatment that ACTUALLY WORKS! Powerful Vitamin B5 fast acne cure normalizes skin oil production. Best natural acne products for face acne and body acne. Stops pimples & oily skin.
Ruby Acne Treatment, Acne, Body ...
by https://www.google.com/accounts/o8/id?id=AItOawmmt5yWC8Y3fZd7Y3mAVyx_I3ASnzslJBw,
November 12, 2011 03:10,
No refactoring, tagged with Acne, Acne Control, Acne Product, Acne Products, Acne Treatment
Proven Top Seller SkinB5 Ac...
cachedResults = {}
expensiveFunction.__index =
...
Ruby In Lua, why does t.k not wo...
by https://www.google.com/accounts/o8/id?id=AItOawmSrR_IfFuPDvqWETu3W8vcWWo1-md_RZA,
November 10, 2011 21:54,
5 refactorings, tagged with lua
Consider the below code. Wh...
def set_name
deal_date = self.deal_date
if (4..12).to_a.include?(self.deal_date.month)
...
Ruby Refactor this code
by https://www.google.com/accounts/o8/id?id=AItOawl-DJ5xgYVFKrrLOGZqwCiGLkx38LeB1cU,
November 10, 2011 21:43,
No refactoring, tagged with ruby, rails3
Please refactor this code.....
"\none\n two\n three".scan(/^( *)\w+/).flatten #=> ["", " ", " "]
Ruby Get rid of useless `flatten`
Hi.
I want to get the ar...
Parameters: {"inventory_order"=>{
"inventory_order_items_attributes"=>{
"0"=>{"inventory_item_id"=>"2", "quantity"=>"1"},
...
Ruby Group Nested Paramaters
by https://www.google.com/accounts/o8/id?id=AItOawkqv2FztAX85ggbYpnN0soQPaUdOEPrtFM,
November 02, 2011 10:36,
1 refactoring, tagged with array grouping
I have a form ( model = Inv...
I still think I could make ...