Re-namespacing a bit to clear out some fairly old stuff from the top level

This commit is contained in:
Dan Buch
2013-01-22 19:10:10 -05:00
parent ab43fb0146
commit 92f7543872
485 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
# read file and write to archive
File.open("archive.log", "a") do |saved|
File.foreach("mylogfile.log") do |sending|
puts("data = #{sending}")
# Make sure we keep a backup
saved.puts(sending) # removed superfluous string interpolation
end
end

View File

@@ -0,0 +1,19 @@
# factorializer!
def fact(n)
if n == 0
return 1
else
return n * fact(n - 1)
end
end
def main()
puts fact(ARGV[0].to_i)
end
if __FILE__ == $0
main()
end

View File

@@ -0,0 +1,31 @@
=begin
OMG this be my comment
=end
class Greeter
def initialize(name="World")
@name = name
end
def say_hi
puts "Hi #{@name}!"
end
def say_bye
puts "Bye #{@name}, y'all come back now."
end
end
def main
grt = Greeter.new("Fizzle")
grt.say_hi()
grt.say_bye()
end
if __FILE__ == $0
main()
end

View File

@@ -0,0 +1,15 @@
def main()
5.times { puts "Mice!\n" }
ele = "Elephants like Peanuts, but they is poison!!"
puts ele + ' is of length = ' + ele.length.to_s
puts "I yam: " + self.to_s
end
if __FILE__ == $0
main()
end

View File

@@ -0,0 +1,27 @@
def hello()
puts 'Hello!'
end
def hello_to(name)
puts 'Hello thar ' + name.to_s
end
def hello_again_to name
puts 'Why hello again ' + name.to_s
end
def main()
puts 'your name be? '
name = gets().chomp()
hello()
hello_to(name)
hello_again_to(name)
end
if __FILE__ == $0
main()
end

View File

@@ -0,0 +1 @@
puts $$

View File

@@ -0,0 +1,2 @@
puts 'dig = ' + (Float::DIG).to_s
puts 'float = ' + (Float::MAX).to_s

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env ruby
puts `ls -l .`
puts 'we be in ' + `pwd`
puts system('hostname -a')

View File

@@ -0,0 +1,14 @@
def has_a_flavor?()
puts 'pick a number'
num = gets().chomp().to_i
if num % 2 != 0
puts 'NO'
else
puts 'YAS'
end
end
if __FILE__ == $0
has_a_flavor?()
end

View File

@@ -0,0 +1,6 @@
rice_on_square = 1
64.times do |square|
puts "On square #{square + 1} are #{rice_on_square} grain(s)"
rice_on_square *= 2
end

View File

@@ -0,0 +1 @@
puts $:

View File

@@ -0,0 +1,11 @@
foo = <<EOS
this be my crazy
big
multiline
string
EOS
puts foo
nums = "20000.0030300"
puts nums.to_f

View File

@@ -0,0 +1,4 @@
puts 'where do ye live?'
STDOUT.flush()
city = gets.chomp()
puts 'yar city be ' + city

View File

@@ -0,0 +1,17 @@
def shabang(*words)
words.each do |word|
puts word + ' shabanngggg'
end
end
def main()
puts 'what ye have to say?'
words = gets().chomp()
shabang(*words.split())
end
if __FILE__ == $0
main()
end