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
{ | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "tsc watch", | |
"type": "shell", | |
"command": "./node_modules/.bin/tsc", | |
"isBackground": true, | |
"args": ["--watch", "--noEmit", "--project", "."], | |
"group": { |
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 function splitArray<T>( | |
array: ReadonlyArray<T>, | |
predicate: (value: T) => boolean, | |
): _.Dictionary<ReadonlyArray<T>> { | |
return array.reduce( | |
(accu, value) => { | |
if (predicate(value)) { | |
return { | |
...accu, | |
truthyPart: [...accu.truthyPart, value], |
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
{ | |
"editor.lineHeight": 25, | |
"workbench.editor.enablePreview": false, | |
"editor.fontFamily": "'Fira Code', 'Consolas', 'monospace' ", | |
"workbench.activityBar.visible": false, | |
"editor.minimap.enabled": false, | |
"files.insertFinalNewline": true, | |
"window.menuBarVisibility": "visible", | |
"window.restoreFullscreen": true, | |
"search.smartCase": true, |
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 resolvedPromise1 = Promise.resolve('Resolved promise 1'); | |
const rejectedPromise = Promise.reject('Rejected promise 1'); | |
const resolvedPromise2 = Promise.resolve('Resolved promise 2'); | |
Promise.all( | |
[resolvedPromise1, rejectedPromise, resolvedPromise2] | |
.map(promise => promise.catch(error => error)) | |
) | |
.then(results => { | |
console.log(results); |
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 { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
class ScrollToTopOnMount extends Component { | |
componentDidMount() { | |
const { top = 0, left = 0, behavior = 'smooth' } = this.props; | |
window.scrollTo({ | |
top, | |
left, |
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 React, { Component } from 'react'; | |
function getTimeComponents(milliseconds = 0) { | |
const seconds = Math.floor((milliseconds / 1000) % 60); | |
const minutes = Math.floor((milliseconds / 1000 / 60) % 60); | |
const hours = Math.floor((milliseconds / (1000 * 60 * 60)) % 24); | |
const days = Math.floor(milliseconds / (1000 * 60 * 60 * 24)); | |
return { | |
days: prefixWithZero(days), |
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
Hello, you beautiful world! |