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
function Event(name){ | |
this.name = name; | |
this.callbacks = []; | |
} | |
Event.prototype.registerCallback = function(callback){ | |
this.callbacks.push(callback); | |
} | |
function Reactor(){ | |
this.events = {}; |
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
var https = require('https'); | |
var fs = require('fs'); | |
var url = 'https://raw.githubusercontent.com/dconnolly/chromecast-backgrounds/master/backgrounds.json'; | |
Array.prototype.getLast = function() { | |
return this[this.length - 1]; | |
}; | |
function logFail(err){ | |
console.log('Failed!'); |
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
[ | |
{ | |
"key": "shift+cmd+d", | |
"command": "editor.action.copyLinesDownAction" | |
}, | |
{ | |
"key": "cmd+l", | |
"command": "expandLineSelection" | |
}, |
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 * as React from 'react'; | |
import { computed } from 'mobx'; | |
import { inject, observer, Provider } from 'mobx-react'; | |
import { fromPromise } from 'mobx-utils'; | |
import {StaticRouter} from 'react-router-dom'; | |
import { Request, Response } from 'express'; | |
import * as ReactDOM from 'react-dom/server'; | |
interface Item { | |
weight: number; |
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
function foo(a) { | |
console.log(a.b) | |
} | |
foo({}) |
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
function power2(a) { | |
return a * a; | |
} | |
power2('string') |
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
/** | |
* Create an input element | |
*/ | |
function createInput(type: 'text', value: string): HTMLInputElement; | |
function createInput(type: 'checkbox', value: boolean): HTMLInputElement; | |
function createInput(type, value) { | |
// code | |
} |
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 input = createInput('checkbox', 'false') |
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
/** | |
* Create an input element | |
* @param {string} type | |
* @param {string|boolean} value | |
* @return {HTMLInputElement} | |
*/ | |
function createInput(type, value) { | |
const el = document.createElement('input'); | |
el.type = type; | |
if (type === 'checkbox') { |
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 * as React from 'react'; | |
import { RouteComponentProps } from 'react-router-dom'; | |
interface LoadableProps<T> { | |
loader: (props: RouteComponentProps<T>) => (() => Promise<React.ComponentType<T>> | React.ComponentType<T>); | |
loading: React.ComponentType<T>; | |
} | |
export function Loadable<T>(loadableProps: LoadableProps<T>) { | |
return class LoadableComponent extends React.Component<RouteComponentProps<T>, { ResultComponent: React.ComponentType<T> }> { |
NewerOlder