$ mix phoenix.new <NAME>
$ cd <NAME>
$ mix ecto.create
// if postgres errors
$ brew install postgresql
$ psql postgres
postgres=# CREATE ROLE postgres;
postgres=# ALTER ROLE postgres LOGIN;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const createStore = (reducer, state = {}) => { | |
let subs = [] | |
const store = (function * () { | |
while (true) { | |
const event = yield null | |
state = reducer(state, event) | |
subs.forEach(fn => fn(state)) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const createStore = (state) => { | |
const noop_handler = state => state | |
state = state || {} | |
var handlers = {} | |
var subs = [] | |
const store = (function * () { | |
while (true) { | |
const { type, payload } = yield null | |
state = (handlers[type] || noop_handler)(state, ...payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
λf.(λx.f(xx))(λx.f(xx)) | |
ZERO = λfx.x | f -> x -> x | |
ONE = λfx.fx | f -> x -> f(x) | |
TWO = λfx.f(fx) | f -> x -> f(f(x)) | |
THREE = λfx.f(f(fx)) | f -> x -> f(f(f(x))) | |
SUCC = λnfx.nfx | n -> f -> x -> n(f)(x) | |
ADD = λmnfx.mf(nfx) || λmn.n succ m | m -> n -> f -> x -> m(n(f))(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import css from "./styles.css" | |
import React from "react" | |
import Counter from "../Counter" | |
import Form from "../Form" | |
import update from "../__lib__/update" | |
import unset from "../__lib__/unset" | |
import set from "../__lib__/set" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xhr from 'superagent' | |
import { Observable } from 'rx' | |
/** body | |
* @description returns the body of a supplied response | |
* @param {Object} response the response from the xhr request | |
* @return {Any} what ever the body is | |
*/ | |
function body (response) { | |
return response.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
env: | |
browser: true | |
node: true | |
es6: true | |
mocha: true | |
protractor: true | |
ecmaFeatures: | |
modules: true | |
jsx: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xhr from "superagent" | |
import { Observable } from "rx" | |
var id = v => v | |
var body = r => r.body | |
var r = (resolve, reject, fn=id) => | |
(err, res) => | |
!!err |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var $ = document.querySelector.bind(document) | |
var createRenderer = register => data => data.reduce((acc, datum) => { | |
var { type } = datum | |
if (type == null || register[type] == null) return acc | |
return [ ...acc, register[type](datum) ] | |
}, []) | |
function Just (value) { | |
if (!isJust(this)) return new Just(value) |
every event type gets an aggregate file. As declaratively as possible we describe what an action does.
// src/aggregates/poll_playlist_response.js
import { GET } from "../tools/http";
import { curryDispatch } from "../tools/curry_dispatch";
export var type = "POLL_PLAYLIST_RESPONSE";