Skip to content

Instantly share code, notes, and snippets.

View ssube's full-sized avatar

Sean Sube ssube

View GitHub Profile
@ssube
ssube / Makefile
Created September 8, 2017 15:53
webpack makefile
# Git
GIT_REF = $(shell git rev-parse --abbrev-ref HEAD)
GIT_REV = $(shell git rev-parse HEAD)
# CI
CI_COMMIT_REF_SLUG ?= $(GIT_REF)
CI_ENVIRONMENT_SLUG ?= local
CI_RUNNER_DESCRIPTION ?= $(shell hostname)
# Debug
@ssube
ssube / Container.ts
Created July 17, 2017 00:10
fairly basic named DI for TS
import {Iterable, List, Map} from 'immutable';
import {isFunction, kebabCase} from 'lodash';
import {InstanceBoundError} from 'main/error/InstanceBoundError';
import {MissingValueError} from 'main/error/MissingValueError';
import {Dependency, Descriptor} from 'main/utility/inject/Dependency';
import {Injected} from 'main/utility/inject/Injected';
import {Factory, Module, ProviderType} from 'main/utility/inject/Module';
export const injectionSymbol = Symbol('inject');

Keybase proof

I hereby claim:

  • I am ssube on github.
  • I am ssube (https://keybase.io/ssube) on keybase.
  • I have a public key ASDLEwK6h9ng108kn_8Qf51KBI9fNhc7Qcn_I_ermKz8Two

To claim this, I am signing this object:

import {Iterable, List, Map} from 'immutable';
import Config from '~/config/Config';
import {Log} from '~/log/Log';
import {Configurable} from '~/utils/Configurable';
import {Dependency, Descriptor} from './Describe';
import {Inject, injectionSymbol} from './Inject';
import {Module, ProviderType} from './Module';
export interface Constructor<R> {
new(...args: Array<any>): R;
this._interval = Observable.interval(1000 / 20).timeInterval();
this._screen.realloc();
let state = 0;
const bufferInput = this._input.getStream().buffer(this._interval);
const frames: Observable<Frame> = this._interval.combineLatest(bufferInput).map((value) => {
return {
actions: value[1],
time: value[0]
export class MultiMap<K, V> implements Map<K, Array<V>> {
protected _map: Map<K, Array<V>>;
constructor(entries: Array<[K, Array<V>]>) {
this._map = new Map(entries);
}
/* simple wrappers */
public clear(): void {
this._map.clear();
@ssube
ssube / emojis.css
Last active November 16, 2016 20:53
SO chat emoji support
@font-face {
font-family: 'Emoji';
src: url('https://rawgit.com/MorbZ/OpenSansEmoji/master/OpenSansEmoji.ttf') format('truetype'),
url('https://rawgit.com/MorbZ/OpenSansEmoji/master/OpenSansEmoji.otf') format('opentype');
/* Emoji unicode blocks */
unicode-range: U+1F300-1F5FF, U+1F600-1F64F, U+1F680-1F6FF, U+2600-26FF;
}
import {Component} from 'react';
import blessed from 'blessed';
export default class BoxComponent extends Component {
constructor(props, context) {
super(props, context);
this.node = blessed.box(props);
}
@ssube
ssube / treelike.js
Last active September 7, 2016 21:16
const data = {
args: [
['foo.bar.baz', 1],
['foo.bar.biz', 2],
['fin', 3]
],
env: {
'APEX_FIN_BIN': 7,
'APEX_FAN_BAN': 8,
'NOPE_NOPE_NOPE': 9,
@ssube
ssube / README.md
Last active June 17, 2016 18:04
eli5-ajax

ELI5: AJAX

This is my attempt to explain AJAX with no JS-specific concepts. Some understanding of C-like syntax and how functions work is needed.

What Is?

AJAX stands for asynchronous JavaScript and XML, but rarely uses XML anymore. The core of AJAX is a request to the server which will not return a value immediately, but call a function with the response later (once it's come over the wire).