This blog post series has moved here.
You might also be interested in the 2016 version.
| import React from 'react'; | |
| import _ from 'lodash'; | |
| import Rx from 'rx'; | |
| import superagent from 'superagent'; | |
| let api = { | |
| host: 'http//localhost:3001', | |
| getData(query, cb) { | |
| superagent |
| defmodule Optional do | |
| def unit(nil), do: {:err, nil} | |
| def unit(value), do: {:ok, value} | |
| def lift(func) do | |
| fn input -> unit(func.(input)) end | |
| end | |
| def bind({:ok, optional}, functor), do: functor.(optional) | |
| def bind(err, _), do: err |
| import Foundation | |
| class Box<T> { | |
| let unbox: T | |
| init(_ value: T) { self.unbox = value } | |
| } | |
| struct Notification<A> { | |
| let name: String | |
| } |
This blog post series has moved here.
You might also be interested in the 2016 version.
(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.
| // Swift Monads -- Maybe | |
| // Juan C. Montemayor (@norsemelon) | |
| // This operator can be used to chain Optional types like so: | |
| // optionalVal >>= f1 >>= f2 | |
| // where f1 and f2 have type `Any -> Any?` | |
| // | |
| // If a value is ever nil, the chain short-circuits and will result in nil. | |
| // This is a much neater way to do this than using the if syntax specified in | |
| // the Swift iBook. |
In many production systems you'll want to have one module capable of talking to many potential implementations of a collaborator module (e.g a in memory cache, a redis-based cache etc). While testing it's useful to control which module the module under test is talking to.
Here are the approaches I can see. The two points that seem to divide the approaches are their tool-ability (dialyzer) and their ability to handle stateful implementations (which need a pid).
Modules are first class, so you can pass them in. Used in EEx, where passed module must implement a behaviour.
| #!/bin/bash | |
| mkdir -p ~/.ssh | |
| # generate new personal ed25519 ssh keys | |
| ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>" | |
| ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>" | |
| # generate new host cert authority (host_ca) ed25519 ssh key | |
| # used for signing host keys and creating host certs |
| # | |
| # PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE | |
| # Pareto/NBD (negative binomial distribution) modeling of | |
| # repeat-buying behavior in a noncontractual setting | |
| # | |
| # Matthew Baggott, [email protected] | |
| # | |
| # Accompanying slides at: | |
| # http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1# | |
| # |