This file contains 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 {Observable as O} from "rx" | |
import makeReactDOM from "@tsers/react" | |
import tsersRun from "./tsersRun" | |
function main({DOM}) { | |
let {h} = DOM | |
let action$ = O.merge( | |
DOM.select('.decrement').events('click').map(ev => -1), | |
DOM.select('.increment').events('click').map(ev => +1) | |
); |
This file contains 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
function Counter({signals, DOM: {render, h, events}, title}, initial$ = Observable.just(0)) { | |
const model = (signals, initial$) => | |
initial$.first().concat(signals.in("inc").merge(signals.in("dec"))).scan((s, a) => s + a).share() | |
const view = (counter$) => | |
[counter$, render(counter$.map(count => | |
h("div", [ | |
h("button.increment", "Increment"), | |
h("button.decrement", "Decrement"), | |
h("p", title + ": " + count) |
This file contains 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 EventEmitter from "events" | |
import {Observable} from "rx" | |
import h from "virtual-dom/h" | |
import diff from "virtual-dom/diff" | |
import patch from "virtual-dom/patch" | |
import el from "virtual-dom/create-element" | |
import selmatch from "matches-selector" | |
import {values, indexBy, prop} from "ramda" | |
const delegate = (name, em) => ({ |
This file contains 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 React from "react" | |
import R from "ramda" | |
const shallowEq = (a, b) => { | |
const aKeys = R.keys(a), bKeys = R.keys(b) | |
if (aKeys.length !== bKeys.length) return false | |
for (let i = 0; i < aKeys.length; i++) { | |
if (a[aKeys[i]] !== b[aKeys[i]]) return false | |
} |
This file contains 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 R from "ramda" | |
const subLens = (by, val, def) => { | |
const orDefault = val => val === undefined ? def : val | |
const matches = R.compose(R.equals(val), by) | |
return R.lens( | |
s => orDefault(R.find(matches, s)), | |
(a, s) => { | |
const idx = R.findIndex(matches, s) | |
return idx >= 0 ? R.set(R.lensIndex(idx), a, s) : s |
This file contains 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
@@ -4,6 +4,7 @@ let VDOM = { | |
h: require(`./virtual-hyperscript`), | |
diff: require(`virtual-dom/diff`), | |
patch: require(`virtual-dom/patch`), | |
+ createElement: require(`virtual-dom/create-element`), | |
parse: typeof window !== `undefined` ? require(`vdom-parser`) : () => {}, | |
} | |
let {transposeVTree} = require(`./transposition`) | |
@@ -60,26 +61,66 @@ function renderRawRootElem$(vtree$, domContainer) { | |
.flatMap(diffAndPatchToElement$) |
This file contains 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
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.CycleDOM = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
},{}],2:[function(require,module,exports){ | |
'use strict'; | |
Object.defineProperty(exports, '__esModule', { | |
value: true | |
}); | |
var isValidString = function isValidString(param) { |
This file contains 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
Using Theano backend. | |
Load data | |
> dataset = ../datasets/sample_xs_2.txt | |
> words | |
- total = 3500 | |
- distinct = 7 | |
> chars = 14 | |
> metadata saved to "./output/meta.json" | |
Generate matrices | |
> dim(X) = (128, 5, 8, 14) |
This file contains 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 React from "react" | |
import {Subject, Observable} from "rx" | |
import {render} from "react-dom" | |
import {Combinator} from "react-combinators/rx" | |
import {createDispatcher} from "fluorine-lib" | |
const initialBMI = {weight: 80, height: 180} | |
function BMI(state, action) { |
This file contains 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
let i = 0 | |
let main = () => document.querySelector("#app").innerHTML = `Seconds elapsed ${i++}` | |
main() && setInterval(main, 1000) |