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
// To mock globally in all your tests, add to setupTestFrameworkScriptFile in config: | |
// https://facebook.github.io/jest/docs/en/configuration.html#setuptestframeworkscriptfile-string | |
jest.mock('moment', () => { | |
const moment = require.requireActual('moment-timezone'); | |
moment.tz.setDefault('America/Los_Angeles'); // Whatever timezone you want | |
return moment; | |
}); |
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
// ts 3.6x | |
function debounce<T extends Function>(cb: T, wait = 20) { | |
let h = 0; | |
let callable = (...args: any) => { | |
clearTimeout(h); | |
h = setTimeout(() => cb(...args), wait); | |
}; | |
return <T>(<any>callable); | |
} |
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
$colours: | |
"red" #FF0000, | |
"blue" #001EFF, | |
"green" #00FF00, | |
"yellow" #F6FF00; | |
@each $i in $colours{ | |
.#{nth($i, 1)}-background { | |
background: nth($i, 2); | |
} |