Skip to content

Instantly share code, notes, and snippets.

View milankinen's full-sized avatar
🐦
tsers

Matti Lankinen milankinen

🐦
tsers
View GitHub Profile
@milankinen
milankinen / app.js
Last active November 5, 2015 14:22
megablob@0.3.0-alpha1 aka "microblob" \o/
import React from "react"
import {render} from "react-dom"
import Bacon from "baconjs"
import {sum} from "lodash"
import {atom} from "megablob"
import {Combinator} from "megablob/react"
function init() {
@milankinen
milankinen / index.js
Created December 2, 2015 08:13
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
@milankinen
milankinen / clientti.js
Created December 2, 2015 08:35
injektio #1
// bundlen entry point
const he = require("he")
const initial = JSON.parse(he.unescape(document.getElementById("state").innerHTML))
console.log(initial)
@milankinen
milankinen / clientti.js
Created December 2, 2015 08:37
injektio #2
const he = require("he")
const initial = JSON.parse(he.unescape(window.INITIAL_STATE))
console.log(initial)
@milankinen
milankinen / clientti.js
Created December 2, 2015 08:42
injektio ilman he:tä
const initial = JSON.parse(app.getAttribute('data-state'))
console.log(initial)
@milankinen
milankinen / ClientOnly.js
Created December 9, 2015 07:55
React ClientOnly component
/*
* <ClientOnly>
* <MyStuff />
* </ClientOnly>
*/
export default React.createClass({
getInitialState() {
return { allowRender: false }
},
componentDidMount() {
@milankinen
milankinen / ServerOnly.js
Created December 9, 2015 08:33
React "ServerOnly" component
import React from "react"
import {findDOMNode} from "react-dom"
export default React.createClass({
componentWillMount() {
if (process.browser) {
this.setState({html: findDOMNode(this).innerHTML})
}
},
render() {
@milankinen
milankinen / tiny-cycle-3.js
Created December 10, 2015 20:08
tiny-cycle-3.js
let i = 0
let main = () => document.querySelector("#app").innerHTML = `Seconds elapsed ${i++}`
main() && setInterval(main, 1000)
@milankinen
milankinen / app.js
Created January 25, 2016 16:29
fluorine+combinators
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) {
@milankinen
milankinen / output.txt
Created February 4, 2016 21:22
deep learning finnish
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)