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

Ruby On Fill Array or create it

by Fu86, May 25, 2011 05:32

@Matthew McEachen: Awesome,...

Ee0505bbd355292778077fb662c88f13 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

Ruby On Reject and merge two arrays

by Fu86, May 11, 2011 01:42

Ah, great stuff! Thanks a l...

Ee0505bbd355292778077fb662c88f13 Talk
a = ["a", "b", "c", "d"]
b = [1, 0, 0, 1]

...

Ruby Reject and merge two arrays

by Fu86, May 06, 2011 07:59, 3 refactorings, tagged with ruby, array, merge, reject, collect

I want to collect all the e...

Ee0505bbd355292778077fb662c88f13 Talk
<%= form_for :page, :url => { :action => :create } do |form| %>
<div class="tabs">
...

Ruby Rails Helper extraction

by Fu86, September 13, 2010 13:45, No refactoring

I want to make this thing m...

Ee0505bbd355292778077fb662c88f13 Talk

C On Extracting directory, filen...

by Fu86, July 06, 2010 15:15

In my opinion, the extensio...

Ee0505bbd355292778077fb662c88f13 Talk
#!/usr/bin/env ruby

require 'gosu'
...

Ruby On Simple graphics program

by Fu86, July 01, 2010 06:38 Star_fullStar_fullStar_fullStar_full

If you want to minimize the...

Ee0505bbd355292778077fb662c88f13 Talk
#!/usr/bin/env ruby

require 'gosu'
...

Ruby On Simple graphics program

by Fu86, July 01, 2010 06:31 Star_fullStar_fullStar_fullStar_fullStar_full
Ee0505bbd355292778077fb662c88f13 Talk
int monster() {
    int rc = 0;
    int dragonRes;
...

C++ On Return in the middle of an ...

by Fu86, June 28, 2010 22:05
Ee0505bbd355292778077fb662c88f13 Talk
class PluginManager
  def initialize
...

Ruby On Ruby Plugin Architecture

by Fu86, June 25, 2010 10:54 Star_fullStar_fullStar_fullStar_fullStar_full
Ee0505bbd355292778077fb662c88f13 Talk
ALTER TABLE Auctions ADD UNIQUE (Salenm)
...

Ruby On Insert new record if it dos...

by Fu86, June 24, 2010 07:54

If you can alter the table,...

Ee0505bbd355292778077fb662c88f13 Talk
def create_files
  %w{ 10K 100K 500K 1M 2M 5M 10M 20M }.map do |size|
    100.times.map {|index| create_file(size)}
...

Ruby On Eliminate temporary collect...

by Fu86, June 23, 2010 23:57 Star_fullStar_fullStar_fullStar_full

You can use Array#flatten t...

Ee0505bbd355292778077fb662c88f13 Talk
mkdir -p {input,sorted,archives}

Bash On Sorting and archiving 1600 ...

by Fu86, June 21, 2010 10:36

You dont need the if tests ...

Ee0505bbd355292778077fb662c88f13 Talk
all_params = $*

...

Ruby On Clumsy file I/O program

by Fu86, June 21, 2010 00:35

The Problem with parameters...

Ee0505bbd355292778077fb662c88f13 Talk
(X AND true) OR (X AND false) == X

...

Ruby On Refactor sanitize_sql_array

by Fu86, June 20, 2010 12:19 Star_fullStar_fullStar_full

You can simplify the WHERE ...

Ee0505bbd355292778077fb662c88f13 Talk

Ruby On Return nil if nothing matched

by Fu86, June 19, 2010 18:58

Thanks a lot. Didn't know t...

Ee0505bbd355292778077fb662c88f13 Talk
def parse_url(url)
  matches = url.match(/\/([\d]{10})/)
  return nil unless matches
...

Ruby Return nil if nothing matched

by Fu86, June 19, 2010 10:16, 3 refactorings, tagged with regular expression, shorten

I want to return nil if not...

Ee0505bbd355292778077fb662c88f13 Talk
memoType = gets.chomp #Removes \n
new_date = Date.parse gets

Ruby On Simple Ruby Program for cre...

by Fu86, June 16, 2010 20:56 Star_fullStar_fullStar_fullStar_full

The "chomp!" is a little bi...

Ee0505bbd355292778077fb662c88f13 Talk
<script type="text/javascript">
    Array.prototype.random = function(){
        var rand = Math.floor(this.length * Math.random());
...

JavaScript On Random URL

by Fu86, October 30, 2007 11:08 Star_fullStar_fullStar_fullStar_full

I think you have forgotten ...

Ee0505bbd355292778077fb662c88f13 Talk