I hereby claim:
- I am tetsuo on github.
- I am tetsuo (https://keybase.io/tetsuo) on keybase.
- I have a public key ASDbwdTJXtudwZoP7yJRtZbv0P7AvC1zaojOMGvs3qrpdgo
To claim this, I am signing this object:
interface Tree<A> { | |
readonly value: A | |
readonly forest: Forest<A> | |
} | |
| |
type Forest<A> = Array<Tree<A>> | |
| |
const draw = (indentation: string, forest: Forest<string>): string => { | |
let r: string = '' | |
const len = forest.length |
import { array } from 'fp-ts/lib/Array' | |
import { fromTraversable, Lens, Prism, Iso } from 'monocle-ts' | |
interface Model { | |
sensors: Array<Sensor> | |
} | |
interface Sensor { | |
ip: string | |
temp: number |
I hereby claim:
To claim this, I am signing this object:
import { createElement } from "react" | |
import { observer } from "mobx-react" | |
const tree = render(state, { | |
createElement: createElement, | |
observer: observer | |
}) | |
ReactDOM.render(tree, document.getElementById("main")) |
const state = State.create({ | |
todos: [ | |
{ title: "Get coffee", done: false }, | |
{ title: "Wake up", done: true } | |
] | |
}) |
const State = types.model("State", { | |
todos: types.array(Todo), | |
get completedCount() { | |
return this.todos.reduce(function(count, todo) { | |
return todo.done ? count + 1 : count | |
}, 0) | |
} | |
}) |
import { types } from "mobx-state-tree" | |
const Todo = types.model("Todo", { | |
title: types.string, | |
done: types.boolean | |
}, { | |
toggle: function() { | |
this.done = !this.done | |
} | |
}) |
<div> | |
<p>You have completed <b>{completedCount}</b> of your tasks.</p> | |
<p><b>Click on more tasks to finish them!</b></p> | |
<ul> | |
{#todos} | |
<li class="{#done}finished{/done}" onclick="toggle">{title}</li> | |
{/todos} | |
</ul> | |
<div> |
import itertools | |
class A: | |
def __init__(self, uniq, key): | |
self.uniq = uniq | |
self.key = key | |
def __repr__(self): | |
return "%s(%s, %s)" % (self.__class__, self.uniq, self.key) |