Sunday, July 21, 2013

Three Rules of TDD

Notes from Bob Martin's screencast:

1. Write the test first.
2. Write only enough of a test to demonstrate a failure.
3. Write only enough of production code to pass the test.

Friday, July 12, 2013

iomega external drive is not showing up on Mac OS

1. In a terminal run : sudo chflags nohidden /Volumes/*

Since I did not know the name of my iomega drive I used the wildcard * instead of the name for the external drive.

2. Unplug the power to the external drive and connect it back to your Mac.

It should work now.

Monday, July 01, 2013

How to Setup Amazon Cloud Front in Rails 3.2 app


I bought my domain at namecheap.com. It is hosted at Linode.

Step 1 : I used Linode control panel to create a CNAME. It looks like this:

CNAME Records
Hostname Aliases to TTL
cdn amazon-provided-id.cloudfront.net Default
www clickplan.net Default

Step 2 : Go to Amazon Cloud Front and setup a CDN distribution. I followed the instructions from this blog: http://happybearsoftware.com/use-cloudfront-and-the-rails-asset-pipeline-to-speed-up-your-app.html

Note that you should also provide alternate domain name. In my case it was cdn.clickplan.net.

Step 3 : In production.rb add :

  config.action_controller.asset_host = "amazon-provided-id.cloudfront.net"

You can also setup a CNAME like cdn.yourdomain.com to point to amazon-provided-id.cloudfront.net. I am using https for the entire site. Since I did not have wildcard SSL certificate, it did not work so I am using https://amazon-provided-id.cloudfront.net for now. Amazon also has a documentation that shows how to use SSL with your cname. If you have issues, make sure you clear all the history in the browser and hit the URL to see if you can view the css and javascript.