1 2
rows_in_order = [1,2,3,4,5,6,7] side == :white ? rows_in_order : rows_in_order.reverse
1 2 3 4
require "set" pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]} ...
Ruby On Find the Intersection of Ar...
by badcarl,
August 01, 2008 04:06
Here is another way. Keep ...
Ruby On Find the Intersection of Ar...
by AviFlombaum,
August 01, 2008 02:21
badcarl - thanks! That's aw...
Ruby On Find the Intersection of Ar...
by AviFlombaum,
July 31, 2008 22:14
Nice! However, the issue wi...
1 2 3
pools = {1 => [1,2,3], 2=> [3,4,5], 3=> [5,6,7]} rej = Hash.new {0} pools.values.flatten.sort.reject! {|elem| rej[elem]++ != 1}
Ruby On Find the Intersection of Ar...
by Maciej Piechotka,
July 31, 2008 22:03
May be something like that
1 2 3 4
# Ruby 1.8.6 pools = {1 => [1,2,3], 2 => [3,4,5], 3 => [5,6,7]} values = pools.values.flatten ...
Ruby On Find the Intersection of Ar...
by Jeremy,
July 31, 2008 21:59
Here are a couple of option...
1 2 3
length = ARGV.last ? ARGV.last.to_i : 140 chars = %w{< > + - . , [ ] [-] ,[.,] >,[.>,] [->+<] >[-]<[->+<]} puts Array.new(length) {chars[rand(chars.length)]}.join[0, length]
1 2 3 4
length = ARGV.last ? ARGV.last.to_i : 140 chars = %w{< > + - . , [ ] [-] ,[.,] >,[.>,] [->+<] >[-]<[->+<]} ...
Ruby On Brainfuck Generator in Ruby
by mattgauger,
July 31, 2008 20:57
Cool, I'm learning lots in ...
1 2 3 4
# generate_bf.rb # (copyleft) Matt Gauger 2008 # Randomly generates a brainfuck program ...
Ruby On Brainfuck Generator in Ruby
by Maciej Piechotka,
July 31, 2008 20:31
A little bit different work...
Java On Closing database connection...
by Marco Valtas,
July 31, 2008 19:06
Hi, you should probably use...
1 2 3 4
class User named_scope :older_than, lambda { |u| { :conditions => ['age > u', u.age] } } end ...
Ruby On How to make instance variab...
by Jeremy,
July 31, 2008 14:21
If you're using Rails 2.1, ...
Ruby On How to make instance variab...
by danielharan,
July 31, 2008 13:51
Persistent storage by addin...
1 2 3
class MyaccountController < ApplicationController before_filter :load_users, :only => [ 'account_details', 'show_email_box', 'show_mobile_box' ] ...
Ruby On How to make instance variab...
by Fabien Jakimowicz,
July 31, 2008 13:33
You can use a before filter...
1 2 3 4
class MyaccountController < ApplicationController before_filter load_users, :only => [ :account_details, :show_email_box, :show_mobile_box ] ...
Ruby On How to make instance variab...
by rafeco,
July 31, 2008 13:31
You could create a before_f...
