Skip to content

Instantly share code, notes, and snippets.

View kotp's full-sized avatar
enjoying life

Victor Goff kotp

enjoying life
View GitHub Profile
@kotp
kotp / hello.rb
Created August 26, 2011 04:21
just a quick test
def hello name
"Hello #{name}"
end
@kotp
kotp / 0.rb
Created October 29, 2011 06:51
Collection of code for The Book Of Ruby Review
puts( not(1 == 1) )
@kotp
kotp / 1.rb
Created November 1, 2011 04:32
Book Review
puts( not( 1 == 1) )
@kotp
kotp / 2.rb
Created November 1, 2011 04:34
Book Review
puts (not(1 == 1) )
@kotp
kotp / error1.txt
Created November 1, 2011 04:34
Book Review
SyntaxError: compile error
(irb):1: syntax error, unexpected kNOT, expecting $end
puts not(1 == 1)
^
from (irb):1
@kotp
kotp / file3.rb
Created November 1, 2011 04:36
Book Review
>> puts (not(1 == 1))
false
=> nil
>> puts( not(1 == 1))
@kotp
kotp / error3.txt
Created November 1, 2011 04:37
Book Review
SyntaxError: compile error
(irb):3: syntax error, unexpected kNOT, expecting ')'
puts( not(1 == 1))
^
(irb):3: syntax error, unexpected ')', expecting $end
from (irb):3
@kotp
kotp / gist:1528866
Created December 28, 2011 17:53 — forked from anonymous/gist:1528862
move file
# require FileUtils
require 'fileutils'
FileUtils.mv 'test.txt', 'test1.txt'
@kotp
kotp / LeapYear.rb
Created December 29, 2011 06:34 — forked from odiepus/LeapYear.rb
Leap Year with Minutes In Year
=begin
doctest: leap_year? for 1900 and 1999 and 2001 is false
>> leap_year?(1900)
=> false
>> leap_year?(1999)
=> false
>> leap_year?(2001)
=> false
doctest: leap_year? for 1904, 1996 and 2000 are true
@kotp
kotp / arrays2.rb
Created February 21, 2012 22:52 — forked from AudreyJean/arrays2.rb
sort without using the built in SORT method
# a little program to accept a list of words, sort them without using the sort method, and output them in alphabetical order
i, j = 0, 0 # initialization of index variables
words, words2 = [], []
a_word = 'a' # dummy initialization to get into the until loop below
puts "Type a word and press <Enter> (Enter a blank line to quit):"
# Loop to accept an unspecified number of words-- creates original array
until a_word.empty?
a_word = gets.chomp
unless a_word.empty?
words.push a_word