Skip to content

Instantly share code, notes, and snippets.

@lguardiola
Last active December 17, 2015 20:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lguardiola/5670101 to your computer and use it in GitHub Desktop.
Save lguardiola/5670101 to your computer and use it in GitHub Desktop.
10.times do |i|
puts i
end
puts DATA.read
__END__
This is
a data content!
10.times do |i|
puts i
end
DATA.rewind
puts DATA.read
__END__
This is
a data content!
DATA.flock(File::LOCK_EX | File::LOCK_NB) or abort "Already running."
trap("INT", "EXIT")
puts "Running..."
loop do
sleep
end
__END__
DO NOT DELETE: use for locking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment