Welcome! This page is using CodeRay 1.1.2.

We currently have 2904 rays in the database.
You can add a New Ray or browse the posted rays by pages.

Page 1, 10 entries

Java code 9 lines of Java 330 Bytes Show Edit Expand
1
2
3
4
  private static boolean[] buildRandomBalancedWord(int n) {
    boolean[] word = new boolean[n * 2];
    List<Integer> positions = IntStream.range(0, 2 * n).boxed().collect(Collectors.toList());
    fo...
test 15 lines of Ruby 269 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
class CreateUsers < ActiveRecord::Migration[5.2]
  def change
    create_table :users do |t|

      # devise required
      t.string :provider
      t.string :uid

      t.string :email
  ...
a 82 lines of Ruby 1.47 KB Show Edit Expand
1
2
3
4
5
6
7
8
9
class Bottles
  def song
    verses(99, 0)
  end
  def verses(starting, ending)
    starting.downto(ending).collect {|i| verse(i)}.join("\n")
  end
  def verse(number)
    bottle_number = B...
a 10 lines of Ruby 154 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
def bottle_number_for(number)
  case number
  when 0
    BottleNumber0
  when 1
      BottleNumber1
  else
    BottleNumber
  end.new(number)
end
a 7 lines of Ruby 140 Bytes Show Edit Expand
1
2
3
4
5
6
7
def bottle_number_for(number)
    if number == 0
      BottleNumber0.new(number)
    else
      BottleNumber.new(number)
    end
  end
a 9 lines of PHP 174 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
class BottleNumber
  def self.for(number)
    begin
      const_get("BottleNumber#{number}")
    rescue NameError
      BottleNumber
    end.new(number)
    # ...
end
a 13 lines of Ruby 200 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
class BottleNumber
  def self.for(number)
    case number
    when 0
      BottleNumber0
    when 1
      BottleNumber1
    when 6
      BottleNumber6
    end.new(number)
  end
  # ...
end
a 21 lines of Ruby 276 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class BottleNumber
  # ...
  def container
    if number == 1
      "bottle"
    else
      "bottles"
    end
  end
  # ...
end

class BottleNumber1 < BottleNumber
  def container
   ...
a 21 lines of Ruby 280 Bytes Show Edit Expand
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class BottleNumber
  # ...
  def quantity
    if number == 0
      "no more"
    else
      number.to_s
    end
  end
  # ...
end

class BottleNumber0 < BottleNumber
  def quantity
  ...
a 14 lines of Ruby 391 Bytes Show Edit Expand
1
2
3
4
5
6
class Bottles
  # ...
  def verse(number)
    bottle_number      = BottleNumber.new(number)
    next_bottle_number = BottleNumber.new(bottle_number.successor)
    "#{bottle_number} ".capitaliz...

Page 1, 10 entries