# If you were doing something like this in your code:
session[:orientation] = setOrDefault

...

Ruby On default value if not define...

by Muke Tever, July 16, 2010 22:57

Depending on how you were u...

F4192eeb4b26e96deab8b5c68926105d Talk
class Numeric
  def evenize_ceil
    self.quo(2).ceil * 2
...

Ruby On Numeric#evenize

by Muke Tever, November 23, 2009 00:21 Star_fullStar_fullStar_fullStar_fullStar_full

The above don't seem to han...

F4192eeb4b26e96deab8b5c68926105d Talk
def get_token
  val = nil
  self.class.precedence.find {|token| val = send(token) }
...

Ruby On lexer

by Muke Tever, November 14, 2009 17:07 Star_fullStar_fullStar_fullStar_full

I think you *could* use fin...

F4192eeb4b26e96deab8b5c68926105d Talk
Number.find(:all, 
...

Ruby On Ruby - Chained collect stat...

by Muke Tever, October 24, 2009 03:45

I had a lot of these in my ...

F4192eeb4b26e96deab8b5c68926105d Talk
class Integer
  def tries options = {}, &block
    return if self < 1
...

Ruby On retry

by Muke Tever, October 12, 2009 12:15 Star_fullStar_fullStar_fullStar_fullStar_full

Well, it looks fine. Thoug...

F4192eeb4b26e96deab8b5c68926105d Talk
@total_pages = total.quo(per_page).ceil

Ruby On Pagination total page count

by Muke Tever, October 07, 2009 06:41

And no need to convert tota...

F4192eeb4b26e96deab8b5c68926105d Talk
Hash[*q.split(/=|&/)]

Ruby On Parse a querystring

by Muke Tever, October 06, 2009 06:29 Star_fullStar_fullStar_fullStar_full

And if for any reason you d...

F4192eeb4b26e96deab8b5c68926105d Talk
def bold_around_pipes (str)
    stack, functional = 0, false
    "'''#{str}'''".each_char.inject('') do |memo, char|
...

Ruby On Ugly split/join

by Muke Tever, September 20, 2009 21:15

Doesn't apply to the immedi...

F4192eeb4b26e96deab8b5c68926105d Talk
name = "female"

if name =~ /male/ 
...

Ruby On ungliness and long too

by Muke Tever, September 11, 2009 06:00 Star_fullStar_fullStar_full

Not a refactoring (the abov...

F4192eeb4b26e96deab8b5c68926105d Talk
birthinfo = "<p class='birthinfo'>%s %s %s %s</p>" % [name, 
  if birthdate.present? || location.present? then "was born %s%s%s." % [
      ("on %s" % birthdate.strftime("%A, %B %e, %Y") unless birthdate.blank?), 
...

Ruby On Massive if/elsif statement ...

by Muke Tever, September 06, 2009 03:45

I discovered a new hammer t...

F4192eeb4b26e96deab8b5c68926105d Talk
xx = case string[/1/] || host[/(a|fd|na|op)/]
     when '1'  then 1
     when 'a'  then "fd"
...

Ruby On Case statement with Regular...

by Muke Tever, August 21, 2009 15:14 Star_fullStar_fullStar_fullStar_full

And here's the same thing w...

F4192eeb4b26e96deab8b5c68926105d Talk
xx = string.include?("1") ? 1 :
     case host[/(a|fd|na|op)/]
     when 'a'  then "fd"
...

Ruby On Case statement with Regular...

by Muke Tever, August 21, 2009 00:37

Tried to make it look nicer...

F4192eeb4b26e96deab8b5c68926105d Talk
# It looks like you're trying to set up for something like this: 

...

Ruby On [Ruby] Iterating...

by Muke Tever, August 07, 2009 05:52

It seems kind of like reinv...

F4192eeb4b26e96deab8b5c68926105d Talk

Ruby On dual object creating in Rails

by Muke Tever, August 03, 2009 18:02

Old book, eh? Have you loo...

F4192eeb4b26e96deab8b5c68926105d Talk
class LoginAttempt < ActiveRecord::Base
  belongs_to :user
  
...

Ruby On Search Filters

by Muke Tever, August 02, 2009 06:11

I haven't used searchlogic,...

F4192eeb4b26e96deab8b5c68926105d Talk
def unbold_pipes (wikibold_string)
     wikibold_string.
      split('|').
...

Ruby Ugly split/join

by Muke Tever, July 30, 2009 19:52, 3 refactorings, tagged with rails, split, regexp

This is supposed to be taki...

F4192eeb4b26e96deab8b5c68926105d Talk

Ruby On Massive if/elsif statement ...

by Muke Tever, July 30, 2009 15:25

I seem to have thrown a str...

F4192eeb4b26e96deab8b5c68926105d Talk
# first sentence
birthinfo = "<p class='birthinfo'>#{name} " 
if birthdate.present? || location.present? {
...

Ruby On Massive if/elsif statement ...

by Muke Tever, July 30, 2009 15:23

I tried to take it apart a ...

F4192eeb4b26e96deab8b5c68926105d Talk

Ruby On Count words in a string

by Muke Tever, May 03, 2009 23:34

Twice as slow for this, and...

F4192eeb4b26e96deab8b5c68926105d Talk