Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000| t = 236 # seconds | |
| Time.at(t).utc.strftime("%H:%M:%S") | |
| => "00:03:56" | |
| # Reference | |
| # http://stackoverflow.com/questions/3963930/ruby-rails-how-to-convert-seconds-to-time |
| #!/bin/bash | |
| # | |
| # Script to create and download a database backup on Heroku | |
| # Written by Chris Stefano (https://github.com/virtualstaticvoid) | |
| # | |
| # See http://devcenter.heroku.com/articles/pgbackups for details | |
| # | |
| appname=$1 | |
| filename=${appname}_db_$(date +%Y%m%d)_$(date +%H%M).pg_backup |
| # ... | |
| gem 'carrierwave' | |
| gem 'fog', '~> 1.0.0' # Need to specify version, as carrierwave references older (0.9.0) which doesn't allow configuration of Rackspace UK Auth URL |
| require 'carrierwave/processing/mini_magick' | |
| class ImageUploader < CarrierWave::Uploader::Base | |
| include CarrierWave::MiniMagick | |
| IMAGE_EXTENSIONS = %w(jpg jpeg gif png) | |
| DOCUMENT_EXTENSIONS = %w(exe pdf doc docm xls) | |
| def store_dir | |
| "files/#{model.id}" |
| # RSpec's subject method, both implicitly and explicitly set, is useful for | |
| # declaratively setting up the context of the object under test. If you provide a | |
| # class for your describe block, subject will implicitly be set to a new instance | |
| # of this class (with no arguments passed to the constructor). If you want | |
| # something more complex done, such as setting arguments, you can use the | |
| # explicit subject setter, which takes a block. | |
| describe Person do | |
| context "born 19 years ago" do | |
| subject { Person.new(:birthdate => 19.years.ago } | |
| it { should be_eligible_to_vote } |