curl https://gist.githubusercontent.com/vslinko/9770944/raw/home.sh | sh
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 DI | |
constructor: -> | |
@container = di: @ | |
register: (name, value) -> | |
@container[name] = value | |
fetch: (name) -> | |
value = @container[name] |
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 MatrixIterator | |
positions: [] | |
constructor: (@arrays) -> | |
@reset() | |
reset: -> | |
@hasNext = true | |
for i in [0...@arrays.length] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 os | |
import math | |
import datetime | |
def format_seconds(seconds): | |
hours, remainder = divmod(int(seconds), 3600) | |
minutes, seconds = divmod(remainder, 60) | |
return "%03d:%02d:%02d" % (hours, minutes, seconds) |
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 React from 'react'; | |
const mounted = {}; | |
const listeners = {}; | |
function startListener(eventName) { | |
if (!listeners[eventName]) { | |
listeners[eventName] = (event) => { | |
mounted[eventName].forEach(([c, cb]) => cb(c.child, event)); | |
}; |
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 R from 'ramda'; | |
import React from 'react'; | |
let scheduled = []; | |
let loaded = false; | |
document.addEventListener('DOMContentLoaded', () => { | |
loaded = true; | |
scheduled.forEach(({flux, Component, selector, props}) => { | |
render(flux, Component, selector, props); |
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 R from 'ramda'; | |
const levels = { | |
debug: 0, | |
log: 1, | |
info: 2, | |
warn: 3, | |
error: 4 | |
}; |
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 React from 'react'; | |
import Rx from 'rx'; | |
import R from 'ramda'; | |
// dispatcher.js | |
const dispatcher = new Rx.ReplaySubject(); | |
function dispatch(action) { | |
dispatcher.onNext(action); | |
} |
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 */ | |
type State = Object | |
type Action = {type: string | void} | |
type AsyncAction = (performAction: FluxPerformFunction, state: State) => void | |
type ActionCreator = () => Action | AsyncAction | |
type StoreFunction = (state: State, action: Action) => State |
OlderNewer