Hosting a static site on an S3 bucket
February 07, 2015I love the recent shift from dynamic sites to static sites. This doesn’t work for all sites. But why have a blog that gets dynamically build on each request. It’s Not needed.
Amazon will host static sites on an S3 bucket and its dead simple. Awesome!
- Create a bucket and set as public host.
- Upload files and make them public.
- Profit.
Migrate a Single Database Migration
January 21, 2013rails console
require "db/migrate/20121130134444_add_column_backorder_to_orders.rb"
AddColumnBackorderToOrders.upConvert a Date String to Ruby Date
January 15, 2013Date.parse '2013/1/15'
DateTime.parse('2013/1/15'+'-23:59:59-6:00')Set default value in rails model
January 14, 2013I like to set default values in my models. This is the method I like to use.
def after_initialize
if new_record?
self.upper_quantity ||= 0.0
end
endFailed to Connect to a Master Node at Localhost:27017
December 31, 2012Everytime my server looses power, Mongo has trouble restarting. These commands fixes the problem.
sudo rm /var/lib/mongodb/mongod.lock sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo service mongodb restart