1
2
3
4
  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, array, hash, translation

i have a simple array that ...

F55e8e113669f6ea7d1d99f38907ce54 Talk
1
2
3
4
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 array, hash

First posting here. I just ...

93fc84c261cdce2e2f1d64c8e531ecb7 Talk
1
2
3
4
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, 3 refactorings, tagged with array, zigzag, ordering

This is the code that is su...

Eee5491d255814140670a5937d53aef3 Talk
1
2
3
    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, 6 refactorings, tagged with ruby, array, split

The example works if the ar...

4ee8e20a519f3afdcd03bcf24681dbd8 Talk
1
2
3
4
<?php

$payload = array(array(
...

PHP Array and ForEach Loop

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

Hi. I'm constructing an XML...

B04f7f475867f6b47a59b49dfabc0daf Talk
1
2
3
4
    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, array, hash

times is an array of dateti...

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

Ruby Enumerable#cluster

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

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

Avatar Talk
1
2
3
4
xml = REXML::Document.new(data)

artists = []
...

Ruby cleaner way to limit result...

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

Wow! All of these refactori...

16462f49b44507dc6522eb9bea0fce51 Talk
1
2
3
4
<?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, loop, iterate, rules, array

I had need for an iterative...

42e1363a474387e41af8f8219797e112 Talk
1
2
3
4
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 array, iteration, loop, each

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

4b81fa52ec2103d12ecbd5993463b2b5 Talk