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 { | |
Object3D, | |
Cache, | |
Texture, | |
PlaneGeometry, | |
MeshLambertMaterial, | |
Mesh, | |
ClampToEdgeWrapping, | |
RepeatWrapping, | |
MirroredRepeatWrapping, |
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
/** | |
* Debounce function that, as long as it continues to be invoked, will not be triggered. | |
* @param {Function} func - Function to be debounced | |
* @param {number} wait - Time in milliseconds to wait before the function gets called. | |
* @param {boolean} [immediate] - Optional immediate flag, if passed, trigger the function on the leading edge, instead of the trailing. | |
* @returns {Function} | |
* @example | |
window.addEventListener('resize', debounce((evt) => console.log(evt), 250)); | |
*/ | |
export function debounce(func, wait, immediate) { |
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 assert = (expectation: any, result: any, test: string = '') => { | |
if (typeof expectation !== typeof result) { | |
test += ` TYPE DIFFERENCE ${typeof expectation} compared to ${typeof result}`; | |
return output(expectation, result, test, false); | |
} | |
if (typeof expectation === 'object') { | |
return assertObj(expectation, result, test); | |
} else if (Array.isArray(expectation)) { | |
return assertArray(expectation, result, test); | |
} else { |
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
type Dictionary<T> = { [key: string]: T }; | |
type Nullable<T> = T | null; | |
// Use `&` for creating an intersection type! | |
type CssStyleObject = Partial<CSSStyleDeclaration> & Dictionary<Nullable<string>>; | |
/** Example | |
* used for declaring partial css style objects | |
**/ | |
interface MyState { |
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' } ] |
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
// 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
<?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
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
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++) { |