Ruby

Gem push

Had this error:

$ gem push -V pmd-1.3.0.gem
GET https://api.rubygems.org/latest_specs.4.8.gz
302 Moved Temporarily
GET https://s3.amazonaws.com/production.s3.rubygems.org/latest_specs.4.8.gz
304 Not Modified
Pushing gem to https://rubygems.org...
POST https://rubygems.org/api/v1/gems
403 Forbidden
You do not have permission to push to this gem.

While the credentials file in ~/.gems/credentials was certainly setup right, the error turned out to be that there was already a gem with that name and the push command was trying to write to that one instead. Renaming the gem fixed this.

Rake default tasks

Adding the followin lines to the Rakefile will catch the situation where you type in $ rake without any parameters and cover any accidental other task.

It will basically list the tasks available.

task :default do
  system "rake --tasks"
end

Webserver

Source

Serve the current working directory on a webserver:

ruby -run -e httpd . -p 8080