This file contains hidden or 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 sys | |
import jiphy # pip install | |
from os import path | |
from types import ModuleType | |
class JsFinder(object): | |
def find_module(self, name, m_path): | |
name += '.js' | |
if m_path is not None: |
This file contains hidden or 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 asyncFetchMiddleware = store => next => action => { | |
let {type, request} = action; | |
if (type.endsWith('_ASYNC')) { | |
fetch(request) | |
.then(response => response.json()) | |
.then(payload => store.dispatch({ | |
type: type.replace(/ASYNC$/, 'SUCCESS'), | |
payload | |
})) | |
.catch(payload => store.dispatch({ |
This file contains hidden or 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 { BehaviourSubject } from 'rx'; | |
export function getStateStream(store) { | |
const sub = new BehaviourSubject(store.getState()); | |
store.subscribe(state => sub.toNext(sub)); | |
return sub.asObservable(); | |
} |
This file contains hidden or 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
from facade import dll | |
import utils | |
print utils.multi_sum(3) |
This file contains hidden or 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
from journey import System, import_all_hooks | |
from journey.sources import tcp_server_source | |
import_all_hooks() | |
sys = System(tcp_server_source('', 3030)) | |
data = sys.run() | |
print(data['statistics']) |
This file contains hidden or 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
'use strict'; | |
const {reactive, link, pipe, observable, observe} = require('xain'); | |
function Xain(state) { | |
class _Xain { | |
constructor(props={}) { | |
const reaction = this.constructor.reaction || (() => ({})); | |
this.props = reactive(Object.assign({}, reaction(state), props)); | |
observe(this.props, this.__renderToScreen.bind(this)); |
This file contains hidden or 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
from types import MethodType | |
LAMBDA_NAME = '<lambda>' | |
def extend(cls, method, name=None): | |
method_name = method.__name__ | |
if method_name == LAMBDA_NAME and name is None: | |
raise NameError('Please provide a usable name for a lambda method') | |
elif name is not None: | |
method_name = name |
This file contains hidden or 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 typing | |
import functools | |
from abc import ABCMeta | |
from inspect import signature, getcallargs | |
class InterfaceMeta(ABCMeta): | |
def __new__(cls, name, bases, namespace, **kwargs): | |
if bases: | |
namespace['__specs__'] = {name: signature(namespace[name]) for name in namespace if name not in ('__qualname__', '__module__')} |
This file contains hidden or 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
# Source this from your .bashrc/.zshrc | |
GIT_CORE="$(git --exec-path)" | |
gn() { | |
command=$1 | |
shift | |
if [ -f "${GIT_CORE}/git-${command}" ]; then | |
git "$command" "$@" | |
else |