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
// get frequency from piano key number t | |
export function keyToFrequency(n, base = 440, keys = 12) { | |
return base * Math.pow(2, n / keys); | |
} | |
// get inverse frequency from piano key number t | |
export function keyToInverseFrequency(n, base = 440, keys = 12) { | |
return base * -Math.pow(2, -n / keys); | |
} |
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
// modified https://github.com/getify/deePool | |
const EMPTY_SLOT = Object.freeze(Object.create(null)); | |
export default class ObjectPool { | |
constructor(objectFactory = () => {}, initialSize) { | |
this.objectFactory = objectFactory; | |
this.objPool = []; | |
this.nextFreeSlot = null; | |
if (!!initialSize) this.grow(initialSize); |
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 daysOffset = 1; // next day delivery | |
const deadlineTime = 17 * 3600; // 17:00 in seconds | |
const unavailableDays = [0, 1]; // sunday = 0, monday = 1 | |
const unavailableDates = [ | |
/* 2019 */ | |
{ dateString: '2019-01-01', name: 'Nieuwjaarsdag' }, | |
{ dateString: '2019-04-01', name: '1e paasdag' }, | |
{ dateString: '2019-04-22', name: '2e paasdag' }, | |
{ dateString: '2019-04-27', name: 'Koningsdag' }, | |
{ dateString: '2019-05-30', name: 'Hemelvaartsdag' }, |
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
git lfs track "*.3ds" "*.3g2" "*.3gp" "*.7z" "*.a" "*.aac" "*.adp" "*.ai" "*.aif" "*.aiff" "*.alz" "*.ape" "*.apk" "*.ar" "*.arj" "*.asf" "*.au" "*.avi" "*.bak" "*.baml" "*.bh" "*.bin" "*.bk" "*.bmp" "*.BMP" "*.btif" "*.bz2" "*.bzip2" "*.cab" "*.caf" "*.cgm" "*.class" "*.cmx" "*.cpio" "*.cr2" "*.csv" "*.cur" "*.dat" "*.dcm" "*.deb" "*.dex" "*.djvu" "*.dll" "*.dmg" "*.dng" "*.doc" "*.docm" "*.docx" "*.dot" "*.dotm" "*.dra" "*.DS_Store" "*.dsk" "*.dts" "*.dtshd" "*.dvb" "*.dwg" "*.dxf" "*.ecelp4800" "*.ecelp7470" "*.ecelp9600" "*.egg" "*.eol" "*.eot" "*.epub" "*.exe" "*.f4v" "*.fbs" "*.fh" "*.fla" "*.flac" "*.fli" "*.flv" "*.fpx" "*.fst" "*.fvt" "*.g3" "*.gif" "*.GIF" "*.graffle" "*.gz" "*.gzip" "*.h261" "*.h263" "*.h264" "*.icns" "*.ico" "*.ief" "*.img" "*.ipa" "*.iso" "*.jar" "*.jpeg" "*.JPEG" "*.jpg" "*.JPG" "*.jpgv" "*.jpm" "*.jxr" "*.key" "*.ktx" "*.lha" "*.lib" "*.lvp" "*.lz" "*.lzh" "*.lzma" "*.lzo" "*.m3u" "*.m4a" "*.m4v" "*.mar" "*.mdi" "*.mht" "*.mid" "*.midi" "*.mj2" "*.mka" "*.mkv" "*.mmr" "*.mng" " |
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 setupDownload() { | |
// quick test to check if download is available on anchors (fake Modernizr implementation) | |
var anchor = document.createElement("A"); | |
var Modernizr = { adownload: "download" in anchor }; | |
delete anchor; | |
if (Modernizr.adownload) { | |
var downloads = document.querySelectorAll("a[download]"); | |
for (var i = 0; i < downloads.length; i++) { |
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
I forked the repo to my own account and then cloned it to my PC | |
git clone https://github.com/bartwttewaall/spicytrip-web.git | |
Then I added a new upstream repository as specified in this article with the original repository url from wirelab | |
git remote add upstream https://github.com/wirelab/spicytrip-web.git | |
I then double checked the remotes with | |
git remote -v | |
and I now see both 2 origin and 2 upstream remotes. |
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 | |
declare(strict_types=1); | |
namespace App\MyBundle\Twig; | |
use Twig\Extension\AbstractExtension; | |
use Twig\TwigFilter; | |
final class MyExtensions extends AbstractExtension |
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
// Intersection | |
let intersection = arrA.filter(x => arrB.includes(x)); | |
// Difference | |
let difference = arrA.filter(x => !arrB.includes(x)); | |
// Symmetrical Difference 1st syntax | |
let symmetricalDifference = arrA | |
.filter(x => !arrB.includes(x)) | |
.concat(arrB.filter(x => !arrA.includes(x))); |
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 linkPattern = /<a\s?(.*?)>([^<\/]*)<\/a>/gim; | |
const contentPattern = /(?:>)(.*?)(?:<)/; | |
const attrPattern = /\b(\S+)="(.*?)(?=")\b/gim; | |
const text1 = 'This is an <a href="#1" rel="noopener">example</a> and here we have <a href="#2" role="button">another one</a>'; | |
const text2 = 'This is an example and here we have <a class="test">another one</a>'; | |
const text3 = 'This is an <a id="empty">empty</a> example'; | |
const text4 = 'This is a bad <a id="unsupported" /> example'; | |
getHtml(text1); // [ { tag: 'a', text: 'example', href: '#1', rel: 'noopener' }, { tag: 'a', text: 'another one', href: '#2', role: 'button' } ] |
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 linkPattern = /<a\s?(.*?)>([^<\/]*)<\/a>/gim; | |
const contentPattern = /(?:>)(.*?)(?:<)/; | |
const attrPattern = /\b(\S+)="(.*?)(?=")\b/gim; | |
const text1 = 'This is an <a href="#1" rel="noopener">example</a> and here we have <a href="#2" role="button">another one</a>'; | |
const text2 = 'This is an example and here we have <a class="test">another one</a>'; | |
const text3 = 'This is an <a id="empty">empty</a> example'; | |
const text4 = 'This is a bad <a id="unsupported" /> example'; | |
getHtmlLinks(text1); // [ { tag: 'a', text: 'example', href: '#1', rel: 'noopener' }, { tag: 'a', text: 'another one', href: '#2', role: 'button' } ] |