View measure-coordinate-distance.js
function measure(lat1, lon1, lat2, lon2){ // generally used geo measurement function
const { PI, cos, sin, sqrt, atan2 } = Math // math fns
const R = 6378.137 // Radius of earth in KM
// PI is equivilant to 180 degrees, so divide PI by 180
// and you get how many radians constitute a single degree
const radsInSingleDegree = (PI / 180)
// Get the amount of radians between the two coordinates
const [dLat, dLon] = [
(lat2 * radsInSingleDegree) - (lat1 * radsInSingleDegree),
(lon2 * radsInSingleDegree) - (lon1 * radsInSingleDegree),
View gist:d2fa36d9b54cc667c2ae90d84f3cb9cc
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
View animate_values.js
/**
* @desc Basic linear value animation that can accept simple easing functions and provides update & complete callbacks
* @param {Object} values - Object with numerical values. eg. { value1: 0, value2: 20, someKey: 55 }
* @param {Number} duration - How long (in milliseconds) the animation will be
* @param {Object} options - target values, update callback & complete callback
* @param {Function} [options.onComplete=(values) => values] - Callback that fires once animation is complete
* @param {Function} [options.onUpdate=(values) => values] - Callback that fires when animation frame updates
* @param {Function} [options.ease=(t) => t] - easing method eg. https://gist.github.com/gre/1650294
* @example
*
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console