Created
April 6, 2010 10:34
-
-
Save cyx/357449 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use e for elements of an Enumerable | |
Item.all.each { |e| puts e.name } | |
# use f for files | |
Dir["app/**/*.rb"].each { |f| require f } | |
# use ex for rescued Exceptions | |
begin | |
open(uri) | |
rescue OpenURI::HttpError => ex | |
puts "Unable to retrieve #{uri}" | |
end | |
# i, j for indices. this actually dates back to C/C++ days in college | |
for i in 1..10 | |
for j in i..10 | |
puts "#{i}, #{j}" | |
end | |
end | |
# x, y, z numbers, definitely reminiscent of math | |
x, y = 5, 10 | |
z = x * y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment