1
2
3
4
  def browser?(b)
    user_agents = {
      :ff   => /Firefox/,
...

Ruby browser detection and url r...

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

i have a simple browser det...

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