array_with_blank_strings.compact.reject(&:blank?)

>> array_with_blank_strings = ["Item 1", "Item 2", " ", "Item 3", nil]
...

Ruby Strip blank Strings and Nil...

by Ivan Vanderbyl, December 07, 2008 21:36, 15 refactorings, tagged with ruby, array, strip, blank

This code will firstly remo...

8991cd8e29cf99d2aebb2301c762e5bd Talk
def browser?(b)
    user_agents = {
      :ff   => /Firefox/,
...

Ruby browser detection and url r...

by seaofclouds, October 16, 2008 18:19, 4 refactorings, tagged with helper, array, browser detect

i have a simple browser det...

F55e8e113669f6ea7d1d99f38907ce54 Talk
def translation_links
    lang = [
      %w[en english us], 
...

Ruby nested array to set of html...

by seaofclouds, October 09, 2008 07:51, 2 refactorings, tagged with ruby, hash, array, translation

i have a simple array that ...

F55e8e113669f6ea7d1d99f38907ce54 Talk
FIELDS = [ 'first', 'last',      'band' ]
DATA   = [['Kurt',  'Cobain',    'Nirvana'],
          ['Jimi',  'Page',      'Led Zeppelin'],
...

Ruby Map fields array and data a...

by charlesroper, September 22, 2008 15:23, 9 refactorings, tagged with hash, array

First posting here. I just ...

93fc84c261cdce2e2f1d64c8e531ecb7 Talk
public static int[] zigzagify(int[] array, int xmax, int ymax) {
        int[] zz = new int[array.length]; //zigzag array
        if (array.length != xmax * ymax) {
...

Java Zig Zag ordering of array

by kane77, August 19, 2008 21:27, 4 refactorings, tagged with array, zigzag, ordering

This is the code that is su...

Eee5491d255814140670a5937d53aef3 Talk
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

by gudata, August 14, 2008 09:49, 11 refactorings, tagged with ruby, array, split

The example works if the ar...

4ee8e20a519f3afdcd03bcf24681dbd8 Talk
<?php

$payload = array(array(
...

PHP Array and ForEach Loop

by goodespeler.myopenid.com, August 12, 2008 17:45, 1 refactoring, tagged with loop, array, foreach

Hi. I'm constructing an XML...

B04f7f475867f6b47a59b49dfabc0daf Talk
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?

by ttdavett.myopenid.com, July 31, 2008 00:11, 7 refactorings, tagged with rails, ruby, hash, array

times is an array of dateti...

F677fa685a2cfe8aff31f161062db3d3 Talk
module Enumerable
    def cluster 
        sort.inject([[]]) do |out, n|
...

Ruby Enumerable#cluster

by Erik, July 18, 2008 02:44, 10 refactorings, tagged with array, inject, cluster

%w[app noot app mies zoo m...

55502f40dc8b7c769880b10874abc9d0 Talk
xml = REXML::Document.new(data)

artists = []
...

Ruby cleaner way to limit result...

by timmyvontrimble.myopenid.com, July 14, 2008 19:12, 10 refactorings, tagged with rails, ruby, xml, array, iteration

Wow! All of these refactori...

16462f49b44507dc6522eb9bea0fce51 Talk
<?php
/*
 * This is a test of a rules based iterative algorithm...
...

PHP Rules Based Iterator

by James Stansfield, June 15, 2008 13:52, 1 refactoring, tagged with php, iterate, loop, array, rules

I had need for an iterative...

42e1363a474387e41af8f8219797e112 Talk
def find_npa(dialed_nxx)
  
  nxx_819 = [ 205, 208, 210, 213, 243 ]
...

Ruby Array iteration

by Titanous, June 11, 2008 23:08, 2 refactorings, tagged with loop, array, iteration, each

I'm new to Ruby, so give me...

4b81fa52ec2103d12ecbd5993463b2b5 Talk