If you’re working on a website and want to test the site and serve your current working directory as the website root, you can do it with Ruby:
ruby -r webrick -e "s = WEBrick::HTTPServer.new...
If you’re working on a website and want to test the site and serve your current working directory as the website root, you can do it with Ruby:
ruby -r webrick -e "s = WEBrick::HTTPServer.new...
You can set the HTTP Expires and Cache-control headers for S3 bucket objects with the Ruby SDK for AWS. This will help site performance by enabling browsers to cache content which is not updated frequently such as stylesheets, javascript files and images.
This assumes you already have the AWS Ruby SDK installed.
You may get this error when trying to use Time.parse
in a Ruby script:
undefined method `parse' for Time:Class (NoMethodError)
If so, try adding this line to the top of your script:
require ...
You can iterate through the items in an S3 bucket and print the names with this Ruby
snippet. It assumes you already have the AWS Ruby SDK installed. Remember to set the
details for your_access_key
, your_secret_access_key
and bucket_name
as appropriate
for your bucket.
There are some Time
extension methods, for example Time.parse
, which are not
automatically imported into Ruby scripts as part of the standard library. To use
these methods you probably need to add this line to the top of your script:
requi...