# chip away at the bonuses play through amounts
bet_through_credit_remaining = self.wager
self.user.bonuses.ranked.each do |bonus|
...
Ruby apply a credit over an orde...
by philrosenstein.myopenid.com,
October 21, 2011 15:14,
15 refactorings, tagged with rails, activerecord, array, 2.3.x
example: if the credit is ...
a = {}
a["test"] = [] if a["test"].nil?
a["test"] << 5
Ruby Fill Array or create it
How can I write this in a c...
input = [9,9,9,9,9,9,9,9,9,9,9,9] input.uniq == 9 ...
Ruby Test if array contains the ...
by astropanic.myopenid.com,
May 23, 2011 07:50,
11 refactorings, tagged with speed, array, uniqueness
How I can check all element...
a = ["a", "b", "c", "d"] b = [1, 0, 0, 1] ...
Ruby Reject and merge two arrays
I want to collect all the e...
def disease_search(query)
treatment_results = Array.new
symptom_results = Array.new
...
Ruby Messy Blocks
by https://www.google.com/accounts/o8/id?id=AItOawncqSogDKAQLilNnxoB32ZKr-9LXu8x3WA,
April 06, 2011 02:50,
6 refactorings, tagged with array, rails activerecord, blocks
This is a really ugly metho...
def disease_search(query)
treatment_results = Array.new
symptom_results = Array.new
...
Ruby Messy Blocks
by https://www.google.com/accounts/o8/id?id=AItOawncqSogDKAQLilNnxoB32ZKr-9LXu8x3WA,
April 06, 2011 02:50,
4 refactorings, tagged with array, rails activerecord, blocks
This is a really ugly metho...
# http://www.ruby-forum.com/topic/163649 class Array ...
Ruby Randomized array pairs to s...
The purpose of this code is...
openid_mapping = {
:email => ["email", "http://axschema.org/contact/email"],
:name => ["fullname", "http://axschema.org/namePerson"]
...
Ruby Hash + Array refactor
by Oriol,
August 19, 2010 17:56,
44 refactorings, tagged with ruby, hash, array, openid, sreg, axschema
This actually works but I w...
def array_to_params(param_name, params)
unless params.is_a?(Array)
result = "&#{param_name}[0]=#{params}"
...
Ruby Generate post query for array
I need to post some array u...
grouped = [] arr = [#<Foo id: 1, status_id: 2, profile_id: 3>,#<Foo id: 2, status_id: 2, profile_id: 3>,#<Foo id: 3, status_id: 1, profile_id: 3>] arr_copy = arr ...
Ruby group objects in array
I'm looking for an optimal ...
User has_many Students Student has_one ReportCard ReportCard has_many Metrics ...
Ruby Ruby - Chained collect stat...
Is there a better way to do...
y_max = 10 arr_data.each do |arr| ...
Ruby 2D array manipulation
by asmega.myopenid.com,
September 12, 2009 13:10,
1 refactoring, tagged with ruby, iterate, array, each, if, break, first
an array within array itera...
tmp = reply.case.users.map(&:email)
tmp.delete(reply.created_by.email)
tmp.join(',')
...
Ruby Remove element from array
by serek.openid.pl,
September 03, 2009 12:12,
3 refactorings, tagged with array, remove, remove element from array
I wanted to remove specific...
def self.all_leaves
leaves = []
Category.roots.each do |category|
...
Ruby array iteration
i dont find a better way to...
class Array # does a kind of ZIP compression for integer arrays # examples: ...
Ruby compressing an array of int...
I've written a small method...
# sum an an array's elements def sum_row(a) sum = 0 ...
Ruby Conditionally deleting colu...
I needed to read in a CSV f...
array_with_blank_strings.compact.reject(&:blank?) >> array_with_blank_strings = ["Item 1", "Item 2", " ", "Item 3", nil] ...
Ruby Strip blank Strings and Nil...
This code will firstly remo...
def browser?(b)
user_agents = {
:ff => /Firefox/,
...
Ruby browser detection and url r...
i have a simple browser det...
def translation_links
lang = [
%w[en english us],
...
Ruby nested array to set of html...
i have a simple array that ...
FIELDS = [ 'first', 'last', 'band' ]
DATA = [['Kurt', 'Cobain', 'Nirvana'],
['Jimi', 'Page', 'Led Zeppelin'],
...
Ruby Map fields array and data a...
First posting here. I just ...
artists = [1, 2, 3]
column_1 = artists[0..artists.size/2]
column_2 = artists[artists.size/2+1..artists.size]
Ruby Split an array into half
The example works if the ar...
times.each do |time|
events.each do |event|
if time.strftime("%I:%M %p") == event.datetime.strftime("%I:%M %p")
...
Ruby two for loops cleanup?
times is an array of dateti...
Hi.
I want to get the ar...