Skip to content

Instantly share code, notes, and snippets.

View frontdevops's full-sized avatar
:octocat:
Develop 𝔾𝕖𝕖𝕜𝕁𝕆𝔹

Sasha Majorović frontdevops

:octocat:
Develop 𝔾𝕖𝕖𝕜𝕁𝕆𝔹
View GitHub Profile
module Singleton {
class Instance {
constructor(public foo: number = 123) {}
}
let instance = new Instance;
export function getInstance() :Instance {
return instance;
namespace Singleton {
interface Instance {
foo: number;
}
const instance :Instance = {
foo: 123
};
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.");
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.");
@frontdevops
frontdevops / simple-jquery.js
Last active October 2, 2019 13:30
Short jQuery implementation on ES7+
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;
};
/* VT100 terminal reset (<ESC>c) */
console.log('\033c');
/* numbers comparations */
> '2' == 2
true
> '2' === 2
@frontdevops
frontdevops / redux-elm__index.d.ts
Created August 4, 2016 08:21
DefinitelyTyped for Redux-elm
/// <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;
@frontdevops
frontdevops / redux-elm__index.js
Last active August 4, 2016 08:17
Redux-elm declarations written on Facebook Flowtype (source file named index.js.flow)
/* @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 = {
{
"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",
{
"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",