A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
A tiny (265 byte) utility to create state machine components using two pure functions.
The API is a single function that accepts 2 pure functions as arguments:
// a basic example demonstrating the power of channels and generators | |
import React from 'react' | |
import { render } from 'react-dom' | |
import { chan, go, take, put, putAsync } from 'js-csp' | |
import { curry } from 'ramda' | |
import Counter from './Counter' | |
// helper | |
const createRender = curry((node, app) => render(app, node)) | |
// create one channel for now |
It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.
Proposal for this year's Reactive lightning talks @ReactiveConf - If you want to see my talk, star this gist please :-) [Reactive Blogpost][reactive-conference-blogpost]
As a JavaScript developer, could you imagine using something else than Atom, Sublime or other IDE-like text-editors? During their daily work, people wrangle a lot with different applications, editors, windows, browsers and loose a lot of time because of their tools getting in their way.
var { PropTypes, requireNativeComponent } = require('react-native'); | |
var React = require('react-native') | |
var { | |
StyleSheet, | |
View, | |
} = React; | |
var iface = { | |
name: 'AdmobView', |
/** | |
* Returns the total amount of disk space used (in MB) by localStorage for the current domain. | |
*/ | |
var getLocalStorageSize = function() { | |
var total = 0; | |
for (var x in localStorage) { | |
// Value is multiplied by 2 due to data being stored in `utf-16` format, which requires twice the space. | |
var amount = (localStorage[x].length * 2) / 1024 / 1024; | |
total += amount; | |
} |
(ns wsclj.core | |
(:gen-class) | |
(:import [javax.jws WebService]) | |
(:import [javax.xml.ws Endpoint])) | |
;; Based on a blog-comment by Jonathan Seltzer | |
(defprotocol Calculator | |
(hello [this yourname]) | |
(add [this a b]) |
(use '[clojure.core.match :only [match]]) | |
(defn evaluate [env [sym x y]] | |
(match [sym] | |
['Number] x | |
['Add] (+ (evaluate env x) (evaluate env y)) | |
['Multiply] (* (evaluate env x) (evaluate env y)) | |
['Variable] (env x))) | |
(def environment {"a" 3, "b" 4, "c" 5}) |