Recent public codes are listed below. You can filter them by the following programming languages:
- view
- All
- Ada
- Assembler
- Assembler
- AWK (gawk)
- AWK (mawk)
- Bash
- bc
- Brainf**k
- C
- C#
- C++
- C++0x
- C99 strict
- CLIPS
- Clojure
- COBOL
- COBOL 85
- Common Lisp (clisp)
- D (dmd)
- Erlang
- F#
- Factor
- Falcon
- Forth
- Fortran
- Go
- Groovy
- Haskell
- Icon
- Intercal
- Java
- JavaScript (rhino)
- JavaScript (spidermonkey)
- Lua
- Nemerle
- Nice
- Nimrod
- Objective-C
- Ocaml
- Oz
- Pascal (fpc)
- Pascal (gpc)
- Perl
- Perl 6
- PHP
- Pike
- Prolog (gnu)
- Prolog (swi)
- Python
- Python 3
- R
- Ruby
- Scala
- Scheme (guile)
- Smalltalk
- SQL
- Tcl
- Text
- Unlambda
- VB.NET
- Whitespace
-
1
puts "hello!"
-
1
-
1 2 3 4 5 6 7 8
def gcp(number) for i in (2..number-1) if number%i == 0 return gcp(number/i) end end return number end
...
-
1 2 3 4 5 6 7 8
def gcp(number) for i in (2..number) if number%i == 0 return gcp(number/i) end end return number end
...
-
1 2 3 4 5 6 7 8
def gcp(number) for i in (2..number) if number%i == 0 return gcp(number/i) end end return number end
...
-
1 2 3 4 5 6 7
class Enumerables def palindrome? return self == self.reverse_each end end print [1,2].respond_to?("palindrome?")
-
1 2 3 4 5 6 7
class Enumerable def palindrome? return self == self.reverse_each end end print [1,2].respond_to?("palindrome?")
-
1 2 3 4 5
h = Hash.new h['size'] = 'big' h['color'] = 'red' h['brand'] = 'ford' puts h.inspect
-
1 2 3 4 5 6 7 8 9
democrats = ["Carter", "Clinton"] republicans = ["Ford", "Reagan", "Bush1", "Bush2"] party = "democrats" if party != nil democrats.each { |i| print i, " "} if party == "democrats" republicans.each { |i| print i, " "} if party == "republicans" print "All presidents since 1976 were either Democrats or Republicans\n"\ if (party != "democrats" && party != "republicans") end
-
1 2 3 4 5 6 7 8 9
democrats = ["Carter", "Clinton"] republicans = ["Ford", "Reagan", "Bush1", "Bush2"] party = ARGV[0] if party != nil democrats.each { |i| print i, " "} if party == "democrats" republicans.each { |i| print i, " "} if party == "republicans" print "All presidents since 1976 were either Democrats or Republicans\n"\ if (party != "democrats" && party != "republicans") end
-
1 2 3 4 5 6 7
my_array = ["alpha", "beta", "gamma"] new_array = my_array.collect do |word| word.capitalize end puts new_array
-
1 2 3 4 5
my_array = ["alpha", "beta", "gamma"] puts my_array.collect do |word| word.capitalize end
-
1 2 3 4
puts my_array.collect do |word| word.capitalize end
-
1 2 3 4 5 6 7 8 9
#!/usr/bin/ruby my_array = ["alpha", "beta", "gamma"] puts my_array.collect { |word| word.capitalize } puts "======================" puts my_array.collect do |word|
...
-
1 2 3 4 5 6 7 8 9
#Chris Nixon #Algorithms II #Fri. Jan. 27th, 2011 #Homework 2 class Sort2DMesh def initialize #creates our initial mesh as an instance variable to be used throughout our class @mesh = [[6, 1, 5, 7, 4, 3, 2, 9],[4, 3, 4, 5, 3, 9, 5, 8], [3, 7, 8, 6, 4, 2, 9, 3],[1, 7, 5, 3, 9, 6, 3, 8], [1, 6, 9, 3, 7, 3, 3, 1], [1, 6, 4, 3, 6, 6, 3, 9], [9, 8, 4, 2, 1, 8, 3, 8], [1, 2, 5, 7, 9, 4, 4, 9]]
...
-
1
puts "testing";
-
1 2 3 4 5 6 7 8 9
def bar puts "entering bar" lambda { raise }.call puts "leaving bar" end def foo puts "entering foo" begin
...
-
1 2 3 4 5 6 7 8 9
def bar puts "entering bar" lambda { raise }.call puts "leaving bar" end def foo puts "entering foo" begin
...
-
1 2 3 4 5 6 7 8 9
def test1 Proc.new { return "test1" }.call end def test2(p) p.call end puts test1
...
-
1 2 3 4 5 6 7 8 9
def proc_test Proc.new { return "Proc.new"}.call return "proc_test finished" end def lam_test lambda { return "lambda" }.call return "lam_test finished" end
...
-
1 2 3 4 5 6 7 8 9
def fib(n) curr = 0 succ = 1 n.times do |i| curr, succ = succ, curr + succ end return curr
...
-
1 2 3 4 5 6 7 8 9
def fib(n) curr = 0 succ = 1 n.times do |i| curr, succ = succ, curr + succ end return curr
...
-
1 2 3 4 5 6 7 8 9
def fib(n) curr = 0 succ = 1 n.times do |i| curr, succ = succ, curr + succ end return curr
...
-
1 2 3 4 5 6 7 8 9
def fib(n) curr = 0 succ = 1 n.times do |i| curr, succ = succ, curr + succ end return curr
...
-
1 2 3 4 5 6 7 8 9
def fib(n) curr = 0 succ = 1 n.times do |i| curr, succ = succ, curr + succ end return curr
...
-
1
-
1 2 3 4 5 6 7 8 9
class MontyHall def initialize @doors = Array.new(3, :goat) @doors[rand(3)] = :car @chosen_door = rand(3) @open_door = rand(3) while @open_door == @chosen_door or @doors[@open_door] == :car @open_door = rand(3)
...
-
1 2 3 4 5 6 7 8 9
class MontyHall def initialize @doors = Array.new(3, :goat) @doors[rand(3)] = :car @chosen_door = rand(3) @open_door = rand(3) while @open_door == @chosen_door or @doors[@open_door] == :car @open_door = rand(3)
...
-
1 2 3 4 5 6 7 8 9
class MontyHall def initialize @doors = Array.new(3, :goat) @doors[rand(3)] = :car @chosen_door = rand(3) @open_door = rand(3) while @open_door == @chosen_door or @doors[@open_door] == :car @open_door = rand(3)
...
-
1 2 3 4 5 6 7 8 9
class MontyHall def initialize @doors = Array.new(3, :goat) @doors[rand(3)] = :car @chosen_door = rand(3) @open_door = rand(3) while @open_door == @chosen_door or @doors[@open_door] == :car @open_door = rand(3)
...


