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 List = require('./list'); | |
const l = new List(50); | |
// setup | |
for (let i = 0; i < 50; i++) { | |
l.set(i, i); | |
} | |
console.log(l.get(5) === 5); |
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
# Make sure to export EDITOR in your .bashrc as either vim or nano. | |
# Make sure to install vipe (npm i -g juliangruber/vipe) | |
# Make sure to install hub (brew install hub) | |
# Don't forget to add your PR title as the first block | |
alias pr="cat .github/PULL_REQUEST_TEMPLATE.md | vipe | hub pull-request -b develop -F -" |
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 |
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
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
'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 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
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
import { BehaviourSubject } from 'rx'; | |
export function getStateStream(store) { | |
const sub = new BehaviourSubject(store.getState()); | |
store.subscribe(state => sub.toNext(sub)); | |
return sub.asObservable(); | |
} |