HOWTO compute distance between 2 addresses using Google Maps API

I recently had a requirement to figure out the distance between an address and a zip code (or it could be an address too). I figured that this is best solved by using Google Maps API. If you are curious on how to do that, read on.
There are couple of ways to get the distance. The first way is the straight line between 2 points (I'm assuming it's flying distance). The second way is the distance between 2 points if you were traveling by car.
Regardless of the way, you need to load a script for JavaScript API: