1
2
3
def extract source, number, attribute
  (0..(number-1)).inject(Array.new) do |result, index|
...

Ruby On Think this needs a loop

by Jason Dew, September 06, 2008 20:21

How about this?

D16d53391068ff0830269149b060789d Talk
1
2
3
4
module DashboardHelper

  def activity_message_for object
...

Ruby On Dashboard

by Jason Dew, July 21, 2008 22:59 Star_fullStar_fullStar_full

I would consider moving the...

D16d53391068ff0830269149b060789d Talk
1
2
3
4
module Enumerable
  def cluster
    inject(Hash.new) do |all, one|
...

Ruby On Enumerable#cluster

by Jason Dew, July 18, 2008 23:36 Star_fullStar_fullStar_full

If you don't need the order...

D16d53391068ff0830269149b060789d Talk

Ruby On cleaner way to limit result...

by Jason Dew, July 15, 2008 00:36

Stream parsing might be som...

D16d53391068ff0830269149b060789d Talk
1
Hash[*uri.query.split("&").map {|part| part.split("=") }.flatten]

Ruby On Query String to Hash

by Jason Dew, July 10, 2008 23:20 Star_fullStar_full

Seems like this should do t...

D16d53391068ff0830269149b060789d Talk
1
2
3
4
class Highlighter

  def initialize(keywords, prefix='*', suffix='*', delimiter=' ')
...

Ruby On Rubyize this : 5th edition

by Jason Dew, January 03, 2008 17:24

i purposely wrote this with...

D16d53391068ff0830269149b060789d Talk

Ruby On Creating an alphabetic for ...

by Jason Dew, December 30, 2007 20:45

I did leave out a piece (th...

D16d53391068ff0830269149b060789d Talk
1
2
3
LETTERS = ('A'..'Z').entries + ['#']
...

Ruby On Creating an alphabetic for ...

by Jason Dew, December 30, 2007 19:22

Apologies, I wrote this cod...

D16d53391068ff0830269149b060789d Talk

Ruby On Refactor my blog item helper

by Jason Dew, December 20, 2007 02:04

very true :-)

D16d53391068ff0830269149b060789d Talk
1
2
3
def list_for_blogentries(user)
...

Ruby On Refactor my blog item helper

by Jason Dew, December 19, 2007 18:46

I didn't consider sorting i...

D16d53391068ff0830269149b060789d Talk
1
2
3
def list_for_blogentries(user)
...

Ruby On Refactor my blog item helper

by Jason Dew, December 19, 2007 13:28

See if this works for you. ...

D16d53391068ff0830269149b060789d Talk
1
2
3
LETTERS = ('A'..'Z').entries + ['#']
...

Ruby On Creating an alphabetic for ...

by Jason Dew, December 17, 2007 00:25

I don't really like having ...

D16d53391068ff0830269149b060789d Talk
1
2
3
class Array
...

Ruby On split_in_groups instead of ...

by Jason Dew, November 28, 2007 17:23 Star_fullStar_fullStar_fullStar_full

here's my first shot at it

D16d53391068ff0830269149b060789d Talk
1
2
3
4
def replace_keywords(keywords, text)
  keywords.each do |keyword, replacement|
    text.gsub! "\{#{keyword}\}", replacement
...

Ruby On Simple Text Replacement

by Jason Dew, November 16, 2007 13:16 Star_fullStar_fullStar_fullStar_full

I agree with Scott about ma...

D16d53391068ff0830269149b060789d Talk
1
2
3
4
def replace_keywords(keywords, text)
  keywords.each do |keyword, replacement|
    text.send( 'gsub!', "\{#{keyword}\}", "#{replacement}" )
...

Ruby On Simple Text Replacement

by Jason Dew, November 16, 2007 03:18 Star_fullStar_fullStar_fullStar_full

How about this?

D16d53391068ff0830269149b060789d Talk

Ruby On Circular Cipher

by Jason Dew, November 10, 2007 02:06

The original and most of th...

D16d53391068ff0830269149b060789d Talk
1
2
3
class Cipher
...

Ruby On Circular Cipher

by Jason Dew, November 07, 2007 03:46 Star_fullStar_fullStar_fullStar_full

this code will be much clea...

D16d53391068ff0830269149b060789d Talk
1
2
3
4
  def add_associated_link(model_name, label = "Add another")
    link_to_function label do |page|
    	page.insert_html :bottom, model_name.pluralize, :partial => model_name, :object => model_name.camelize.constantize.new
...

Ruby On Combining add/remove links

by Jason Dew, October 16, 2007 23:25 Star_fullStar_fullStar_fullStar_full

I don't see where you use t...

D16d53391068ff0830269149b060789d Talk