Skip to content

Instantly share code, notes, and snippets.

@wesrich
wesrich / location.js
Last active August 29, 2015 14:07
Geo Location
(function($) {
calculateDistance = function(lat,lng,lat2,lng2) {
return Math.sqrt( Math.pow(69.1 * (lat2 - lat), 2) +
Math.pow(69.1 * (lng - lng2) * Math.cos(lat2 / 57.3), 2) );
}
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var LatLngvar=new google.maps.LatLng(position.coords.latitude, position.coords.longitude, true);
if (typeof(addMapDistances) != "undefined") {
console.log(position.coords.latitude, position.coords.longitude);
@wesrich
wesrich / 0_reuse_code.js
Created June 20, 2014 14:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console