Skip to content

Instantly share code, notes, and snippets.

@compwron
Created April 12, 2015 23:41
Show Gist options
  • Save compwron/d645e5e4ce60e035c534 to your computer and use it in GitHub Desktop.
Save compwron/d645e5e4ce60e035c534 to your computer and use it in GitHub Desktop.
run if file
# Only run the following code when this file is the main file being run
# instead of having been required or loaded by another file
if __FILE__==$0
# Find the parent directory of this file and add it to the front
# of the list of locations to look in when using require
$:.unshift File.expand_path("../../", __FILE__)
end
# http://stackoverflow.com/questions/4687680/what-does-if-file-0-mean-in-ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment