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
module Singleton { | |
class Instance { | |
constructor(public foo: number = 123) {} | |
} | |
let instance = new Instance; | |
export function getInstance() :Instance { | |
return instance; |
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
namespace Singleton { | |
interface Instance { | |
foo: number; | |
} | |
const instance :Instance = { | |
foo: 123 | |
}; | |
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
class Singleton { | |
protected static _instance :Singleton = new Singleton; | |
protected foo :number = 123; | |
constructor() { | |
if (Singleton._instance) { | |
throw new Error("Instantiation failed: "+ | |
"use Singleton.getInstance() instead of new."); |
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
class Singleton { | |
protected static _instance :Singleton; | |
protected foo :number = 123; | |
constructor() { | |
if (Singleton._instance) { | |
throw new Error("Instantiation failed: "+ | |
"use Singleton.getInstance() instead of new."); |
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 $ = ::document.querySelectorAll; | |
{ | |
let p = Element.prototype; | |
p.on = Element.prototype.addEventListener; | |
p.find = function(s){ return this.querySelector(s) }; | |
p.html = function(s){ | |
if(!s) return this.innerHTML; | |
this.innerHTML = s; | |
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
/* VT100 terminal reset (<ESC>c) */ | |
console.log('\033c'); | |
/* numbers comparations */ | |
> '2' == 2 | |
true | |
> '2' === 2 |
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
/// <reference path="../../react/react.d.ts"/> | |
declare module "redux-elm" { | |
import ReactElement = __React.ReactElement; | |
export type Action = Object; | |
export type StatelessReactComponent = (props :Object) => ReactElement; | |
export type Component = ReactElement | StatelessReactComponent; | |
export type Dispatch = (action :Action) => void; |
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
/* @flow */ | |
import type { Component as ReactComponent } from 'react'; | |
export type Action = Object; | |
export type StatelessReactComponent = (props : Object) => ReactElement; | |
export type Component = ReactComponent | StatelessReactComponent; | |
export type Dispatch = (action : Action) => void; | |
export type MatcherResult = { |
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
{ | |
"scripts": { | |
"start-prod": "API_HOST=$(curl -s \"http://${ETCD_HOST:-10.0.100.100}:${ETCD_PORT:-80}/v2/keys/config-project/frontend/service/restapi\"|jq '.node.nodes[0].value'|tr -d '\"') better-npm-run start-prod", | |
}, | |
"betterScripts": { | |
"start-prod": { | |
"command": "node ./bin/server.js", | |
"env": { | |
"NODE_ENV": "production", | |
"NODE_PATH": "./src", |
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
{ | |
"name": "Front-service", | |
"main": "bin/server.js", | |
"scripts": { | |
"start-prod": "better-npm-run start-prod", | |
"start-dev": "better-npm-run start-dev" | |
}, | |
"betterScripts": { | |
"start-prod": { | |
"command": "node ./bin/server.js", |