"\none\n two\n  three".scan(/^( *)\w+/).flatten #=> ["", " ", "  "]

Ruby Get rid of useless `flatten`

by Shamaoke, November 06, 2011 02:11, 5 refactorings, tagged with ruby, array, scan

Hi.

I want to get the ar...

E4c1e34040468dff738dda2a3349a36a Talk
# 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 ...

20bffe332e5534f3ea328698ecb0a938 Talk
user_id = xx
users = [....]

...

Ruby move a element of array to top

by Fred Liang, July 06, 2011 07:22, 6 refactorings, tagged with array

There are some elements in ...

48986aabbdbcdeacdbc3a6dc2945a9ff Talk
a = {}
a["test"] = [] if a["test"].nil?
a["test"] << 5

Ruby Fill Array or create it

by Fu86, May 24, 2011 05:07, 3 refactorings, tagged with ruby, hash, array

How can I write this in a c...

Ee0505bbd355292778077fb662c88f13 Talk
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...

55502f40dc8b7c769880b10874abc9d0 Talk
a = ["a", "b", "c", "d"]
b = [1, 0, 0, 1]

...

Ruby Reject and merge two arrays

by Fu86, May 06, 2011 07:59, 3 refactorings, tagged with ruby, array, merge, reject, collect

I want to collect all the e...

Ee0505bbd355292778077fb662c88f13 Talk
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...

55502f40dc8b7c769880b10874abc9d0 Talk
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...

55502f40dc8b7c769880b10874abc9d0 Talk
<?php
...

PHP Get value of array key with...

by Tim, January 06, 2011 23:54, 1 refactoring, tagged with validation, array, improve, simplify

Hi, I am looking for a code...

0635a8e46531193666e660800916ed64 Talk
# http://www.ruby-forum.com/topic/163649
class Array
...

Ruby Randomized array pairs to s...

by TimK, October 20, 2010 01:43, 2 refactorings, tagged with rails, random, array

The purpose of this code is...

2722012beb9afcad75df5c9f2229fd8c Talk
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, 29 refactorings, tagged with ruby, hash, array, openid, sreg, axschema

This actually works but I w...

E4679be8d7d2484f9c0b8c4df71f4d2a Talk
<?php
    public function get_usd_value($date)
    {
...

PHP What is bad in this code?

by https://www.google.com/accounts/o8/id?id=AItOawk89fkb9x-moiNmY07jOpKHwIT1tUTiK6M, August 17, 2010 15:53, 2 refactorings, tagged with php, array, array string loop each

I know that variable naming...

144314100b686db946ff68c7ae1065d1 Talk
class Array
    
  def count_by(&block)
...

Ruby Array.group_by that counts

by matt, June 26, 2010 23:38, 5 refactorings, tagged with ruby, array, group_by

I want an array method that...

081c31620e9ed8dca87afeeeeb279f68 Talk
def array_to_params(param_name, params)
  unless params.is_a?(Array)
    result = "&#{param_name}[0]=#{params}"
...

Ruby Generate post query for array

by zealer.livejournal.com, June 01, 2010 11:06, 4 refactorings, tagged with POST, array

I need to post some array u...

167c4580d7b338553023cc575ecc2af7 Talk
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

by toro04, March 29, 2010 13:44, 4 refactorings, tagged with array

I'm looking for an optimal ...

8abd3736ee784dcd159d3b26b882076e Talk
void freeArray(int **a, int m) {
    int i;
    for (i = 0; i < m; ++i) {
...

C Freeing memory of a Multidi...

by Andreas Grech, November 28, 2009 17:18, 2 refactorings, tagged with c, array, malloc, free

Is this the correct way to ...

C398dd0c2ca7d5281d0a83242a924e76 Talk
User has_many Students
Student has_one ReportCard
ReportCard has_many Metrics
...

Ruby Ruby - Chained collect stat...

by umanghc.myopenid.com, October 23, 2009 23:02, 4 refactorings, tagged with ruby, array

Is there a better way to do...

55502f40dc8b7c769880b10874abc9d0 Talk
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...

8969b3dc2e4211b514c08ee9879bb0c4 Talk
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...

597821ce12359ab2d95437c8164d5254 Talk
/**
 * Generates a multi-column table from an array 
 *
...

PHP Generate table from array

by gwrtheyrn, July 24, 2009 10:48, 5 refactorings, tagged with php, table, array

This function generates a m...

D3bd7339e1941bc25c05110b69a82721 Talk
def self.all_leaves
    leaves = []
    Category.roots.each do |category|
...

Ruby array iteration

by RoadHouse, July 23, 2009 23:12, 5 refactorings, tagged with rails, ruby, array

i dont find a better way to...

70089e712ed13abb99bec89bd5bfba77 Talk
class Array
  # does a kind of ZIP compression for integer arrays
  # examples:
...

Ruby compressing an array of int...

by Alec Leitner, April 14, 2009 20:49, 4 refactorings, tagged with ruby, array, compression

I've written a small method...

72820eaf703cd07ba9bc6ecc09e5d81a Talk
procedure CopyIntoArray(var DestArray: Array of Byte; SourceArray: Array of Byte; StartIndex: integer);
var
  i: integer;
...

Delphi Array Helper Functions

by jamiei, February 02, 2009 00:04, 3 refactorings, tagged with pointers, array, delphi

To get this Section started...

Ec72b0ab3eb1855c56fd04bcc886f65c Talk
$(document).ready(function(){
	// get the text file to be parsed
	$.get('test-data.txt', function(textData){
...

JavaScript Split text into unordered l...

by keif, January 23, 2009 17:10, 5 refactorings, tagged with javascript, loop, array, jquery, List

Using jQuery, I'm trying to...

802c73427a78116c398cfb6765be9c08 Talk
# sum an an array's elements
def sum_row(a)
  sum = 0
...

Ruby Conditionally deleting colu...

by srboisvert.myopenid.com, December 18, 2008 00:18, 6 refactorings, tagged with ruby, array, csv

I needed to read in a CSV f...

12d6a2e5971e661ee2bf2994526e848d Talk