Skip to content

Instantly share code, notes, and snippets.


Xerxes Noble XerxesNoble

Block or report user

Report or block XerxesNoble

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
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),
XerxesNoble / gist:d2fa36d9b54cc667c2ae90d84f3cb9cc
Created Jul 18, 2017 — forked from chrsgrffth/gist:c2b33896138aa1894cfd
Forward Port 80 to 3000 for Node.js (from StackOverflow)
View gist:d2fa36d9b54cc667c2ae90d84f3cb9cc
sudo iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3000
XerxesNoble / animate_values.js
Last active Apr 10, 2019
Basic javascript linear value animation that can accept easing functions and provides update & complete callbacks
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.
* @example
XerxesNoble / 0_reuse_code.js
Created Jan 25, 2016
Here are some things you can do with Gists in GistBox.
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
You can’t perform that action at this time.