layouts = Dir.glob("_layouts/*")
layouts.each do |layout|
  layout.gsub!(/^_layouts\/(.*)\..*$/, '\1')
...

Ruby List the files in a directo...

by Aziz Light, February 01, 2012 08:46, 2 refactorings, tagged with ruby, ruby1.9

The title says it all, I'm ...

D69bd6b89f0c9204eed89de9d7ee4632 Talk
Weeks = [["2012-01-15","2012-01-22"], ["2012-01-22","2012-01-29"], ["2012-01-29","2012-02-05"],["2012-02-05","2012-02-12"], ["2012-02-12","2012-02-19"], ["2012-02-19","2012-02-26"]]  

...

Ruby clean the code

by https://www.google.com/accounts/o8/id?id=AItOawlaTnwjQ00W1XCRaUEGIonvKgruTMebfak, January 30, 2012 03:54, 4 refactorings, tagged with ruby, rails 3

Plz help me clean the code
...

55502f40dc8b7c769880b10874abc9d0 Talk
# Start of file, showing the name of the application
# Size, and all relevent parts of the title

...

Ruby Address Book

by https://www.google.com/accounts/o8/id?id=AItOawkiJON4MFJ9bopD8IvwQ1pbpH3ag7yrtnI, December 28, 2011 07:36, 5 refactorings, tagged with ruby, methods, regexp, regular expression

This is a fairly simple add...

55502f40dc8b7c769880b10874abc9d0 Talk
#more elegante way? 
sector = Sector.create(:name => name) unless sector = Sector.find_by_name(sector)

Ruby more elegant way

by RoadHouse, December 01, 2011 09:52, 5 refactorings, tagged with ruby, activerecord, rails3

no ideas about it, rails 3....

70089e712ed13abb99bec89bd5bfba77 Talk
#MM-YYYY
"2011-10".split("-").reverse.join("/") => "10/2011"

Ruby parsing date

by RoadHouse, November 24, 2011 12:40, 3 refactorings, tagged with ruby, date

anyone has the better solut...

70089e712ed13abb99bec89bd5bfba77 Talk
require_relative 'nice_stuff'

class Sheet
...

Ruby strange method

by Pyro, November 24, 2011 03:10, No refactoring, tagged with ruby, constants, inheritance

I have strange feeling abou...

547616d5e4aaee90426e7051dd766a5a Talk
#!/usr/bin/env ruby
# encoding: utf-8

...

Ruby Tasks list

by Aziz Light, November 16, 2011 20:02, 6 refactorings, tagged with command line, ruby

This script takes one argum...

D69bd6b89f0c9204eed89de9d7ee4632 Talk
def set_name
    deal_date = self.deal_date
    if (4..12).to_a.include?(self.deal_date.month)
...

Ruby Refactor this code

by https://www.google.com/accounts/o8/id?id=AItOawl-DJ5xgYVFKrrLOGZqwCiGLkx38LeB1cU, November 10, 2011 21:43, No refactoring, tagged with ruby, rails3

Please refactor this code.....

55502f40dc8b7c769880b10874abc9d0 Talk
"\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
#customers
  %table#customerTable
    - @customers.each_with_index do |customer, i|
...

Ruby Refactor for table "ge...

by danielz.myopenid.com, October 02, 2011 03:51, 6 refactorings, tagged with ruby, table, haml, challenge

Hey Guys,

I'm stuck with...

51bedeb346fa52074fe8bd52d6fe3ff0 Talk
#!/usr/bin/env ruby

require 'rubygems'
...

Ruby automatic info plist versio...

by slf, September 30, 2011 11:30, No refactoring, tagged with ruby, git, xcode, plist

I hacked up a script to aut...

098e5c1a565b47e9860539fbebc3fa98 Talk
require 'set'

class StatComputations
...

Ruby Mean Median in Ruby

by https://www.google.com/accounts/o8/id?id=AItOawl0nTuHS77YHoJ_YssSDUGitTHCLZVvgrA, August 28, 2011 20:10, 1 refactoring, tagged with ruby, ruby1.9, mean, median

Here is the snippet of mean...

B6d7dffed1196ab1a2ac35504a0cb03c Talk
require "rspec"

module PrimeModule
...

Ruby Programming puzzle

by michal-pochwala.myopenid.com, August 24, 2011 07:35, 2 refactorings, tagged with ruby, puzzle

Problem to solve:

The pr...

55502f40dc8b7c769880b10874abc9d0 Talk
@visits_by_day_and_hour = visits.group_by{|day| day.created_at.strftime("%Y-%m-%d")}.map {|d, items| [d, items.group_by{|hour| hour.created_at.strftime("%H")}.map{|k,v| [k, v.length]}]}

Ruby Group array elements by day...

by https://www.google.com/accounts/o8/id?id=AItOawlsPHX5ps6aEa58SFp7fTjKFgMmK9Hi-Dg, August 07, 2011 23:45, 2 refactorings, tagged with ruby, arrays, group_by, map array

Hi, I have a set of objects...

55502f40dc8b7c769880b10874abc9d0 Talk
# Operators => Priority
OPERATORS={
  '+' => 0,
...

Ruby Simple tokenizer

by tzar, August 06, 2011 03:17, No refactoring, tagged with ruby, parsing

Takes a string and returns ...

9a75a91432c4a6b40bfbb6c6016296ec Talk
if @image.update_attributes params[:product_image]
  if request.xhr?
    render :json => { :status => 'success', :data => {:message => I18n.t('product_image.results.reordered')} }
...

Ruby DRY up a controller action

by Nick, August 05, 2011 11:13, 6 refactorings, tagged with rails, ruby, controller, DRY

Any suggestions for DRYing ...

49de4cd2f26705785cbef2b15a9df7aa Talk
def some_method(format, language)
  raise Error unless %w(wiki xml).include?(format.to_s)
  raise Error unless %w(de en).include?(language.to_s)
...

Ruby Check for bounds

by Fu86, July 19, 2011 02:35, 2 refactorings, tagged with ruby, method, params, bounding

I need to check the given i...

Ee0505bbd355292778077fb662c88f13 Talk
module Reopened

  def reopened
...

Ruby Execute code when a class i...

by dagobah.myopenid.com, July 15, 2011 05:07, 1 refactoring, tagged with class, ruby, mixins, reopen, trace

Is there a less hacky way t...

55502f40dc8b7c769880b10874abc9d0 Talk
def append
  string = ''
  5.times do
...

Ruby append string in iterator

by ololo777.myopenid.com, July 15, 2011 05:06, 4 refactorings, tagged with string, ruby

not good enough(

55502f40dc8b7c769880b10874abc9d0 Talk
module Protected
  module ClassMethods
...

Ruby Access control on methods

by dagobah.myopenid.com, July 12, 2011 07:39, No refactoring, tagged with ruby, mixins, authorization, rbac, modules, access control, keys, locks

Is there a better/more eleg...

55502f40dc8b7c769880b10874abc9d0 Talk
#!/usr/bin/env ruby -w

=begin
...

Ruby Simple RSS/XML test

by deepspring, July 08, 2011 02:35, 1 refactoring, tagged with reader, ruby, rss

I got bored and decided to ...

56438d61fd1c1b7d352a12c9b402f4a9 Talk
# order_item.rb
#
 
...

Ruby rental_has_been_refunded?

by chipcastle.myopenid.com, June 23, 2011 13:37, 3 refactorings, tagged with ruby

Looking for a more concise ...

31e2b397e15442a2d3ba42db7bd4584e Talk
class IsbnsController < ApplicationController
  before_filter :correct_user, :only => [:destroy, :edit, :show, :update, :index, :new, :create]
  before_filter :correct_user_admin,   :only => [:destroy]
...

Ruby Horrific if/else nonsense i...

by https://www.google.com/accounts/o8/id?id=AItOawmBoZDYdn9kg9NpUnuCgDniTetBixwn3iQ, June 10, 2011 05:16, 2 refactorings, tagged with rails, ruby, if-else

Posting for the comedy/shoc...

55502f40dc8b7c769880b10874abc9d0 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
# start here, on_data called where thereis data on a socket(data can be partial-packet)
def on_data bytes
  @stream << bytes
...

Ruby Packet handling in network-app

by Bubonic Pestilence, May 07, 2011 04:51, 4 refactorings, tagged with ruby, networking, packet

Just looking for better arc...

8bb326c6aeddd50cdabca0716a4233b6 Talk