This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Resolver { | |
protected $container; | |
public function __construct($container) | |
{ | |
$this->container = $container; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function guestGuard(routes) { | |
return routes.map(route => { | |
return { | |
...route, | |
beforeEnter: (to, from, next) => { | |
if(confirm('continue guest guard?')) { | |
next(); | |
} else { | |
next(false); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue'; | |
/** | |
* Handles laravel form requests errors. | |
*/ | |
export class FormErrors { | |
constructor() { | |
this.setErrors({}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const box = { | |
sw: {long: -16.14990234375, lat: -26.980828590472107}, // bl | |
ne: {long: 39.7265625, lat: 20.632784250388028}, // tr | |
}; | |
const points = [ | |
{long: 21.62109375, lat: 3.601142320158735}, // inside | |
{long: -11.513671874999998, lat: 16.551961721972525}, // inside | |
{long: 28.4765625, lat: -19.228176737766248}, // inside | |
{long: 4.130859375, lat: 0.4394488164139768}, // inside |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const distance = function(point1, point2) { | |
const R = 6371; // Radius of the earth in km | |
const dLat = (point2.lat - point1.lat) * Math.PI / 180; | |
const dLong = (point2.long - point1.long) * Math.PI / 180; | |
let a = 0.5 - Math.cos(dLat) / 2 + Math.cos(point1.lat * Math.PI / 180) * Math.cos(point2.lat * Math.PI / 180) * (1 - Math.cos(dLong)) / 2; | |
return R * 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const interpolatedSteps = (geojson, numSteps = 4) => { | |
let minMax = []; | |
if (geojson.features.length < 1) { | |
minMax = [1, numSteps]; | |
} else { | |
minMax = geojson.features.reduce((minMax, feature) => { | |
minMax[0] = Math.min(minMax[0] || feature.properties.hits, feature.properties.hits); | |
minMax[1] = Math.max(minMax[1], feature.properties.hits); | |
return minMax; |