Skip to content

Instantly share code, notes, and snippets.

Matti Lankinen milankinen

  • Finland
Block or report user

Report or block milankinen

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
View example.ts
import * as L from "partial.lenses";
interface State {
foo: {
lol: number;
bal: string;
items: Item[];
milankinen / index.js
Last active Nov 13, 2018
Sync promise resolution with fibers (tested with Node v11.1.0)
View index.js
const vm = require("vm");
const { resolve, run } = require("./sync");
// in "master"
const calls = [];
const log = console.log.bind(console);
const random = Math.random;
// in "worker"
milankinen / index.js
Created Feb 8, 2017
CULLI state (de)composition
View index.js
import * as O from "most"
import * as L from "partial.lenses"
import DOM from "@culli/dom"
import Store, {Memory, byType} from "@culli/store"
import {run} from "@cycle/most-run"
// partial.lenses lens => culli lens
const P = (pl) => ({
get: L.get(pl),
set: L.set(pl)
milankinen / devtools.js
Last active Oct 28, 2016
Redux devtools integration with @culli/store
View devtools.js
import {O, extend} from "@culli/base" // you can replace this with your own streaming library if you want
import Memory from "./memory"
function ReduxDevtools(initial) {
const devtools = window.__REDUX_DEVTOOLS_EXTENSION__
if (!devtools) {
return Memory(initial)
milankinen / main.js
Last active Oct 24, 2016
CULLI teaser
View main.js
import * as O from "most"
import {run} from "@cycle/most-run"
import DOM from "@culli/dom"
import Store, {Memory} from "@culli/store"
import HTTP from "@culli/http"
run(GithubSearch, {
DOM: DOM("#app"),
// create store using in-memory persintence
milankinen / main.js
Last active Sep 22, 2016
Reduxish Stanga
View main.js
import {Observable as O} from "rx"
const store = reducer => R.lens(R.identity, reducer)
const myStore = store((action, state) => {
switch (action.type) {
case "INC": return state + 1
case "DEC": return state - 1
default: return state
View monkey.js
Rx.Observable.prototype.log = function(prefix) {
return process.env.NODE_ENV !== "development" ? this : this
.doOnCompleted(() => console.log(prefix, "<completed>")) // eslint-disable-line
.do(x => console.log(prefix, x)) // eslint-disable-line
// const obs = Rx.Observable.fromEvent(text, "input")
// .log("InputEvent:")
// .map(e =>
// .filter(t => !!t)
milankinen / main.js
Created Mar 22, 2016
Cycle "advanced" counter with parent state sharing
View main.js
import Rx, {Observable as O} from "rx"
import Cycle from "@cycle/core"
import {h, makeDOMDriver} from "@cycle/dom"
import isolate from "@cycle/isolate"
function Counter({DOM, initial$}) {
const mod$ = O.merge(".dec").events("click").map(ev => state => state - 1),".inc").events("click").map(ev => state => state + 1)
milankinen / app.js
Created Mar 22, 2016
"Advanced" Cycle.js list example
View app.js
import {Observable as O} from 'rx'
import L from "partial.lenses"
import R from "ramda"
import {h3, div} from '@cycle/dom'
import isolate from '@cycle/isolate'
import Ticker from './ticker'
import {liftListById, flatCombine, flatMerge} from "stanga"
function intent(tickers$) {
milankinen / main.js
Last active Mar 17, 2016
TSERS "cyclish"
View main.js
import {Observable as O} from "rx"
import makeReactDOM from "@tsers/react"
import tsersRun from "./tsersRun"
function main({DOM}) {
let {h} = DOM
let action$ = O.merge('.decrement').events('click').map(ev => -1),'.increment').events('click').map(ev => +1)
You can’t perform that action at this time.