Skip to content

Instantly share code, notes, and snippets.

@benwilson512
Created July 16, 2012 19:36
Show Gist options
  • Save benwilson512/3124563 to your computer and use it in GitHub Desktop.
Save benwilson512/3124563 to your computer and use it in GitHub Desktop.
last_file = Dir.open('.').select{|d| d.include?("output")}.sort.last
current_session = last_file ? last_file.match(/[0-9]{1,}/).to_s.to_i + 1 : 0
File.open("output#{current_session}.txt", 'a') do |f|
puts "Session: #{current_session}"
while thought = gets != "that's all for now\n"
print "\e[2J\e[f" # clear the screen.
f.write(thought)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment