This file contains 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
/*handy arrow function definitions*/ | |
/* | |
const lerp = (a,b,x) => a+x*(b-a); | |
const qarp = (a,b,c,x) => lerp(lerp(a,b,x),lerp(b,c,x),x); | |
const unlerp = (a,b,y) => (y-a)/(b-a); | |
const lerpUnlerp = (a, b, c, d, x) => a+((x-c)/(d-c))*(b-a); | |
*/ | |
/** | |
* Linear interpolation |
This file contains 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
#!/usr/bin/env bash | |
# Import collections in a specified folder to your mongo database | |
# requires 2 arguments | |
# 1) the database to import to | |
# 2) the folder containing the collections to import | |
# example usage | |
# sh mongo_import.sh dev ~/Documents/PROJECTS/example/mongo\ export | |
if [ -z ${1+x} ] || [ -z ${2+x} ]; then |
This file contains 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
/** | |
* Sorting markers in rows from left to right. Because geolocation can be pretty | |
* detailed we can't just sort it as is, we need a math to make it feel natural. | |
* | |
* How this works: | |
* - Prioritise sorting on latitude (y-axis) | |
* - multiply the difference and round it this will "group" locations in rows. | |
* - 30 is an arbitrary value that felt good in my case, higher values will make tighter rows. | |
* - (Using `1` as multiplier you will see the sorting jumps long distances from left to right.) | |
* - If 0 (same row), sort by longitude, with full precision |
This file contains 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
/* global Headway */ | |
import React, { memo } from 'react'; | |
const HW_CONFIG_ACCOUNT = 'your-id-here'; // get this from env-variables | |
const ELEMENT_ID = 'headway-updates-widget'; | |
function HeadwayWidget() { | |
// No need to render if no account is configured | |
if (!HW_CONFIG_ACCOUNT) { | |
return null; |