1 2 3 4
i = 0 for j in ['foo', 'bar', 'baz'] puts "#{i} #{j}" ...
Ruby Python's enumerate in Ruby?
by robby86533.identity.net,
July 14, 2008 23:02,
3 refactorings, tagged with python, ruby, for, enumerate
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...
1 2 3 4
module DiscreteDistribution # pick_random is useful for spliting up a collection by its specified discrete distribution ...
Ruby Randomly pick an item base ...
by David Dai,
June 15, 2008 06:02,
No refactoring, tagged with random, algorithm, discrete, discrete distribution, ruby, load balance, multivariate, ab-test
This method is useful to lo...
1 2 3 4
module Every @interval, @stopped = 0.0, true @numwords = {"one"=>1, "two"=>2, "three"=>3, "four"=>4, "five"=>5, "six"=>6, "seven"=>7, "eight"=>8, "nine"=>9, ...
Ruby Every repeat module
Loop a block of code every ...
1 2 3
<!-- THE XML IM TRYING TO PARSE --> ...
Ruby Trying to parse XML and pas...
I am completely new to ruby...
1 2 3 4
require 'net/http' require 'rubygems' require 'xmlsimple' ...
Ruby Parsing XML from a Web Service
I'm working with a web serv...
1 2 3 4
class VotingSystem #Hello, I am Rodger the old and unhappy programmer. the variable nbrOfVotes is an array of 2 dimensions. The first dimension contains the number of votes for the answer "YES, IT SUCKS"... and the other dimension contain the number of votes for the answer "NO, IT DOESN'T SUCK". In the near future there will be other possible answers... but I don't care! I retire in 2 days! @@nbrOfVotes = Array.new ...
Ruby Rubyize this : 6th edition
Ouch... this guy badly need...
1 2 3 4
# OPTIMIZE: I think we can do a LOT for optimize this. def create added_counter = 0 ...
Ruby Importing large collection ...
This scripts get textarea w...
1 2 3 4
<table class="charge"> <tr> <td colspan="100%" class="mainHeader"><%=@label.label%></td> ...
Ruby Iterating through a nested ...
by mwilliams,
January 31, 2008 18:21,
2 refactorings, tagged with rails, view, table, hash, nested hash, iterator, iterate, ruby, Ruby on Rails
Good afternoon. I have a n...
1 2 3 4
def planned_percent_complete if self.planned_complete_in_dollars != nil (( self.planned_complete_in_dollars.to_f / self.task.budget.to_f ) * 100).round(2) ...
Ruby Same methods, different Act...
I know there has to be a "r...
1 2 3 4
def self.find_matches(params) matches = self.find(:all) ...
Ruby Filtering Method Needs to b...
by bradly.myopenid.com,
January 04, 2008 16:38,
No refactoring, tagged with ruby, rails, filtering, wet
I know it looks long, but i...
1 2 3 4
module Enumerable def to_a(n = nil) result = [] ...
Ruby Enumerable#to_a with termin...
by Ben Kudria,
December 24, 2007 23:36,
No refactoring, tagged with ruby, enumerable, finite, countable, countability
Please see this ruby-talk t...
1 2 3 4
#!/usr/bin/ruby -w status, *cmd = ARGV ...
Ruby script for subversion statu...
by philippe.rathe.myopenid.com,
December 17, 2007 19:01,
2 refactorings, tagged with ruby, subversion, svn, tools
For those who work with sub...
1 2 3 4
require 'find' excludes = [".svn", "lib", "modules", "feathers"] exclude_files = [] ...
Ruby Crawl a directory and searc...
This recursively goes throu...
1 2 3 4
def which_class? if self.language == "C/C++" self.language = "sh_cpp" ...
Ruby class picker
language is a column in a c...
What is the best way to emu...