Skip to content

Instantly share code, notes, and snippets.

GitHub was acquired

André Staltz staltz

GitHub was acquired
Block or report user

Report or block staltz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
staltz /
Last active Sep 20, 2019
The introduction to Reactive Programming you've been missing
staltz / example.js
Created Mar 18, 2019
Build your own RxJS
View example.js
function createObservable(subscribe) {
return {
pipe: function(operator) {
return operator(this);
const numberObservable = createObservable(function(observer) {
staltz /
Last active Aug 16, 2019
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

staltz / router.js
Last active Aug 5, 2019 — forked from axefrog/router.js
Simple router driver for Cycle.js utilising Router5 for routing functionality and adapting some of the code from VisionMedia's Page.js for automatic link click intercepting
View router.js
'use strict';
import {Router5, RouteNode} from 'router5';
import logger from '../logger';
// The set of valid sink functions includes synchronous state-affecting router functions that do not require a callback
// and which do not have a significant return value other than the router object itself.
const validSinkFuncs = ['add','addNode','canActivate','deregisterComponent','navigate','registerComponent','setOption','start','stop'];
function validateAndRemapSinkArgument(arg) {
staltz /
Created Mar 15, 2017
Nested Pick<T, K> in TypeScript 2.2

TypeScript supports Pick to allow you to get a "subset" object type of a given type, but there is no built-in Pick for deeper nested fields.

If you have a function that takes a large object as argument, but you don't use all of its fields, you can use Pick, Pick2, Pick3, etc to narrow down the input type to be only just what you need. This will make it easier to test your function, because when mocking the input object, you don't need to pass all fields of the "large" object.

staltz / adnetworks.txt
Created Nov 20, 2016
Ban these domains of ad networks
View adnetworks.txt,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
staltz / main.js
Created Jun 22, 2016
A-Frame + Cycle.js demo
View main.js
import xs from 'xstream';
import Cycle from '@cycle/xstream-run';
import {h, makeDOMDriver} from '@cycle/dom';
function main(sources) {
let vdom$ = xs.periodic(16).startWith(0).map(i =>
h('a-scene', [
h('a-sphere', {
attrs: {
staltz / readme.ts
Created Apr 25, 2018
View readme.ts
* Callbag loves TypeScript
* Copy-paste this into
// A Callbag dynamically receives input of type I
// and dynamically delivers output of type O
type Callbag<I, O> = {
(t: 0, d: Callbag<O, I>): void;
staltz /
Last active Dec 28, 2018
How to show migration guides in GitHub Markdown

How to show migration guides in GitHub Markdown

Use the diff code highlighting tag.

  - foo
  + bar


View pull-stream-to-observable.ts
export function drained$<T>(pullStream: Function): Rx.Observable<T> {
return Rx.Observable.create(function subscribe(observer: Rx.Observer<T>) {
const drain = function drain(read: Function) {
read(null, function more(end: any | boolean, data: T) {
if (end === true) {
if (end) {
You can’t perform that action at this time.