(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. | 
(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.
This blog post series has moved here.
You might also be interested in the 2016 version.
| import Foundation | |
| class Box<T> { | |
| let unbox: T | |
| init(_ value: T) { self.unbox = value } | |
| } | |
| struct Notification<A> { | |
| let name: String | |
| } | 
| 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 React from 'react'; | |
| import _ from 'lodash'; | |
| import Rx from 'rx'; | |
| import superagent from 'superagent'; | |
| let api = { | |
| host: 'http//localhost:3001', | |
| getData(query, cb) { | |
| superagent | 
Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.
These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.
Create a Dokku app:
| (* | |
| ParserLibrary_v1.fsx | |
| Version 1 of the code for a parser library. | |
| Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators/ | |
| *) | |
| open System | 
$ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>$ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>| defmodule Randomizer do | |
| @moduledoc """ | |
| Random string generator module. | |
| """ | |
| @doc """ | |
| Generate random string based on the given legth. It is also possible to generate certain type of randomise string using the options below: | |
| * :all - generate alphanumeric random string | |
| * :alpha - generate nom-numeric random string |