Skip to content

Commit

Permalink
fix indenting to get markdown to recognise the code block properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Glenn Tweedie committed Aug 22, 2011
1 parent 9dec65e commit 0f4e340
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions docs/storage/index.markdown
Expand Up @@ -85,29 +85,29 @@ Now you've got a bunch of files in S3: your resume, some code samples,
and maybe some pictures of your cat doing funny stuff. Since this is and maybe some pictures of your cat doing funny stuff. Since this is
all of vital importance, you need to back it up. all of vital importance, you need to back it up.


# copy each file to local disk # copy each file to local disk
directory.files.each do |s3_file| directory.files.each do |s3_file|
File.open(s3_file.key, 'w') do |local_file| File.open(s3_file.key, 'w') do |local_file|
local_file.write(s3_file.body) local_file.write(s3_file.body)
end end
end end

This comment has been minimized.

Copy link
@rollick

rollick Sep 2, 2011

Nice work nocache!



One caveat: it's way more efficient to do this: One caveat: it's way more efficient to do this:


# do two things per file # do two things per file
directory.files.each do |file| directory.files.each do |file|
do_one_thing(file) do_one_thing(file)
do_another_thing(file) do_another_thing(file)
end end


than it is to do this: than it is to do this:


# do two things per file # do two things per file
directory.files.each do |file| directory.files.each do |file|
do_one_thing(file) do_one_thing(file)
end.each do |file| end.each do |file|
do_another_thing(file) do_another_thing(file)
end end


The reason is that the list of files might be large. Really The reason is that the list of files might be large. Really
large. Eat-all-your-RAM-and-ask-for-more large. Therefore, every time large. Eat-all-your-RAM-and-ask-for-more large. Therefore, every time
Expand Down

0 comments on commit 0f4e340

Please sign in to comment.