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
const state = { | |
counter: 0 | |
}; | |
const randomInt = (min, max) => | |
Math.floor(Math.random() * (max - min + 1)) + min; | |
const sleep = (min, max = min) => | |
new Promise(resolve => { | |
setTimeout(resolve, randomInt(min, max)); |
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
{ | |
// See https://go.microsoft.com/fwlink/?LinkId=733558 | |
// for the documentation about the tasks.json format | |
"version": "2.0.0", | |
"tasks": [ | |
{ | |
"label": "Run", | |
"type": "shell", | |
"windows": { | |
"command": "C:\\Octave\\Octave-4.2.1\\bin\\octave-gui.exe", |
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
@stores({ | |
... | |
}) | |
@debouncePropsUpdate({ | |
x: 1000, | |
}) | |
@throttlePropsUpdate({ | |
y: 1000, | |
}) | |
class MyComponent extends React.Component { |
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
import autobind from './autobind'; | |
class Base { | |
constructor(v) { | |
this.v = v; | |
} | |
} | |
function multiply(by) { | |
return function $multiply(target, name, descriptor) { |
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
import match, { $, $$$ } from 'match-with'; | |
// l is a list | |
const length = match(l).with( | |
// $() is a single-item named placeholder | |
// $$$() is a rest-collecting named placeholder | |
// .when(predicate) adds a guard predicate | |
clause([$('head'), $$$('tail')]).when(({ tail }) => tail.length > 0)).then(({ head, tail }) => 1 + tail.length), |
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
const willUnmount = Symbol('unmount'); | |
function statefulComponent(getInitialState, render, componentWillUnmount = () => void 0) { | |
return function*(props) { | |
const internalId = React.pleaseGiveMeAnInternalId(); | |
const state = getInitialState(props); | |
const setState = (nextState) => { | |
Object.assign(state, nextState); | |
React.pleaseRerenderThisInternalId(internalId); | |
}; |
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
const $x = Symbol(); | |
const t = { $x: 4, y: 5, z: 6 }; | |
const { [$x], ...collect } = t; // collect = { y: 5, z: 6 } |
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
let x; | |
class A { | |
constructor() { | |
this.a = true; | |
// explictly returns this | |
return this; | |
} | |
} |
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
Show hidden characters
{ | |
"always_show_minimap_viewport": true, | |
"bold_folder_labels": true, | |
"color_scheme": "Packages/Oceanic Next Color Scheme/Oceanic Next.tmTheme", | |
"copy_with_empty_selection": true, | |
"ensure_newline_at_eof_on_save": true, | |
"font_family": "Consolas", | |
"font_options": "subpixel_antialias", | |
"highlight_line": true, | |
"highlight_modified_tabs": true, |
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
@component(() => ({ | |
users: ['remote://users', {}], | |
})) | |
@component(({ users }) => | |
users.mapKeys((userId) => | |
[`user:${userId}`, [`remote://users/${userId}`, { firstName: 'John', lastName: 'Doe' }]] | |
).toObject() | |
) | |
class UserList extends React.Component { | |
render() { |