GPS coordinate distance : Javascript

http://www.geodatasource.com/developers/javascript

function distance(lat1, lon1, lat2, lon2, unit) {
var radlat1 = Math.PI * lat1/180
var radlat2 = Math.PI * lat2/180
var theta = lon1-lon2
var radtheta = Math.PI * theta/180
var dist = Math.sin(radlat1) * Math.sin(radlat2) + Math.cos(radlat1) * Math.cos(radlat2) * Math.cos(radtheta);
dist = Math.acos(dist)
dist = dist * 180/Math.PI
dist = dist * 60 * 1.1515
if (unit==”K”) { dist = dist * 1.609344 }
if (unit==”N”) { dist = dist * 0.8684 }
return dist
}

Laravel 5.x: Specified key was too long error

Laravel 5.4 made a change to the default database character set, and it’s now utf8mb4 which includes support for storing emojis.

This only affects new applications and as long as you are running MySQL v5.7.7 and higher you do not need to do anything.

As outlined in the Migrations guide to fix this all you have to do is edit your AppServiceProvider.php file and inside the boot method set a default string length:

use Illuminate\Support\Facades\Schema;

public function boot()
{
Schema::defaultStringLength(191);
}

After that everything should work as normal.

https://laravel-news.com/laravel-5-4-key-too-long-error