(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
{-| | |
> ``` | |
Consider a simple model for whether a person has the flu or not. Let F=1 | |
indicate that a person has the flu and F=0 indicate that they don't have the | |
flu. Let C=1 indicate that the person has a cough and C=0 indicate that they | |
don't have a cough. Let M=1 indicate that the person has muscle pain and M=0 | |
indicate that they don't have muscle pain. Assume that C and M are conditionally | |
independent given F so that the probability model is | |
P(C=c,M=m,F=f)=P(C=c|F=f)P(M=m|F=f)P(F=f). | |
Suppose that we ask two different doctors to supply probabilities for this model |
-- paste into http://elm-lang.org/try and click "compile" | |
-- http://imgur.com/gallery/W6TwgZw | |
import Graphics.Collage exposing (..) | |
import Graphics.Element exposing (..) | |
import Text | |
import Color exposing (..) | |
import Time | |
import Signal |
Max Goldstein | July 30, 2015 | Elm 0.15.1
In Elm, signals always have a data source associated with them. Window.dimensions
is exactly what you think it is, and you can't send your own events on it. You can derive your own signals from these primitives using map
, filter
, and merge
, but the timing of events is beyond your control.
This becomes a problem when you try to add UI elements. We want to be able to add checkboxes and dropdown menus, and to receive the current state of these elements as a signal. So how do we do that?
language: node_js | |
node_js: | |
- iojs | |
env: | |
global: | |
# https://docs.saucelabs.com/ci-integrations/travis-ci/ | |
# SAUCE_USERNAME | |
- secure: Daa... |
import test from 'tape'; | |
const before = test; | |
const after = test; | |
// beforeEach/afterEach rely on shared state. | |
// That's a big anti-pattern for testing. | |
// It's also silly to run something before and after | |
// ever test -- many of your tests won't need it. |
So I was curious how mocha implements their: "be synchronous if callback is undefined, be async if callback is defined". The way to do this is by using Function.length
// fn, fn -> null
function detect (fn, cb) {
if (fn.length) return fn(() => cb())
fn() && cb()
}
{ | |
"env": { | |
"browser": true, | |
"node": true, | |
"es6": true | |
}, | |
"ecmaFeatures": { | |
"modules": [2] | |
}, |
@mixin ie6 { * html & { @content } } | |
#logo { | |
background-image: url("/images/logo.png"); | |
@include ie6 { background-image: url("/images/logo.gif"); } | |
} |