Skip to content

Instantly share code, notes, and snippets.

@coop
Created August 26, 2012 08:13
Show Gist options
  • Save coop/3476099 to your computer and use it in GitHub Desktop.
Save coop/3476099 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
if ARGV.first
File.open(ARGV.first, 'r') do |file|
counter = 0
file.each_line { |line| counter += 1 }
puts "#{counter} lines"
end
else
puts "Pass the path to the file you want to read"
end
#! /usr/bin/env ruby
print "Enter the size: "
number = gets.chomp
number.to_i.times { |n| print '#' }
puts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment