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 * as Lint from 'tslint'; | |
| import * as ts from 'typescript'; | |
| import { inspect } from 'util'; | |
| /** | |
| * This rule will ensure that methods marked with the "@expose" decorator must be declared in at | |
| * least one interface implemented by the class. It will also ensure that the return type of this | |
| * method has no excess properties compared to those specified in the interface | |
| */ |
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 friendList = [ | |
| { id: 1, name: 'Phoebe' }, | |
| { id: 2, name: 'Rachel' }, | |
| { id: 3, name: 'Ross' }, | |
| ]; | |
| function useFriendStatus(component, friendID) { | |
| const onlineStatus = component.useState(null); | |
| const handleStatusChange = (status) => onlineStatus.set(status.isOnline); |
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
| [[20, -3, 3], [20, -4, 0.6], [134, 5, 0.35], [618, 5, 0.53], [8000, 3.5, 1.3], [20000, -8, 0.4]] |
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 make(classOrFn, ...args) { | |
| if (classOrFn.toString().startsWith('class ')) { | |
| // "real" non-compiled ES6+ only | |
| return new classOrFn(...args); | |
| } | |
| let thisArg = Object.create(classOrFn.prototype); | |
| let retVal = classOrFn.apply(thisArg, args) | |
| if (retVal != null) return retVal; | |
| return thisArg; // | |
| } |
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
| module Main where | |
| import Prim | |
| import Control.Alt ((<|>)) | |
| import Control.Apply ((<*>)) | |
| import Data.Either (Either(..)) | |
| import Data.Foldable (intercalate) | |
| import Data.Functor ((<$>), map) | |
| import Data.String.CodePoints (contains) |
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
| ``` | |
| R__________ | |
| / \ | |
| a___ b1__ | |
| / \ / \ | |
| a2 b3 a3 b2__ | |
| / \ / \ / \ / \ \ | |
| e1 e2 e3 e4 e5 e6 e7 e8 e9 | |
| ``` |
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 interface MobxCanvasProps { | |
| width?: number; | |
| height?: number; | |
| style?: any; | |
| render(ctx: CanvasRenderingContext2D): void; | |
| } | |
| @observer | |
| export class MobxCanvas extends React.Component<CanvasProps> { | |
| private canvasRef = React.createRef(); |
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
| script -qfc 'yarn repro' /dev/null > raw.log | |
| cat -vet raw.log |
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 { validator, validate } from './experiment'; | |
| class U { | |
| @validator() name!: string; | |
| } | |
| class C { | |
| @validator() id!: string; | |
| @validator() u!: U; | |
| } |
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 {observable, computed, action, extendObservable} = mobx; | |
| const {observer} = mobxReact; | |
| const {Component} = React; | |
| let debounce = delay => (object, key, descriptor) => { | |
| let getter = descriptor.get | |
| let state = new WeakMap(); | |
| function initializeState(self) { |