The popular open-source contract for web designers and developers by Stuff & Nonsense
- Originally published: 23/12/2008
- Revised date: 15/12/2013
- Original post
import { tagged } from "daggy"; | |
const First = tagged("First", ["val"]); | |
First.prototype.concat = function(that) { | |
return this; | |
}; | |
const Min = tagged("Min", ["val"]); |
const daggy = require("daggy"); | |
const { Loop, Done } = daggy.taggedSum("Loop", { | |
Loop: ["b"], | |
Done: ["a"] | |
}); | |
Array.empty = () => []; | |
const Pair = T => { |
const Promise = require("fantasy-promises"); | |
const daggy = require("daggy"); | |
//- Regular `compose` - old news! | |
//+ compose :: (b -> c) | |
//+ -> (a -> b) | |
//+ -> a -> c | |
const compose = f => g => x => f(g(x)); | |
//- `chain`-sequencing `compose`, fancily |
const daggy = require("daggy"); | |
const { uncurryN } = require("wi-jit"); | |
Array.prototype.empty = () => []; | |
const Sum = daggy.tagged("Sum", ["value"]); | |
Sum.prototype.concat = function(that) { | |
return Sum(this.value + that.value); | |
}; |
const { tagged } = require("daggy"); | |
const Pair = tagged("Pair", ["_1", "_2"]); | |
//+ data Store p s = Store (p -> s) p | |
const Store = tagged("Store", ["lookup", "pointer"]); | |
Array.prototype.equals = function(that) { | |
return ( | |
this.length === that.length && |
const { Left, Right } = require("fantasy-eithers"); | |
const daggy = require("daggy"); | |
Function.prototype.map = function(f) { | |
return x => f(this(x)); | |
}; | |
//- Where everything changes... | |
const login = user => (user.name == "Tom" ? Right(user) : Left("Boo")); |
import fetch from 'isomorphic-fetch' | |
const setupRequestOptions = (options = {}, overrideMethod) => { | |
if (overrideMethod) options.method = overrideMethod | |
if (!options.headers) options.headers = {} | |
options.credentials = 'same-origin' | |
return options | |
} | |
const setupJsonRequestOptions = (options, overrideMethod) => { |
. | |
├── assets | |
│ ├── images | |
│ ├── sass/less/stylus/css | |
├── lib | |
│ ├── actions | |
│ ├── components | |
│ │ ├── __tests__ | |
│ │ │ └── Avatar.test.jsx | |
│ │ └── Avatar.jsx |
// Detect autoplay | |
// --------------- | |
// This script detects whether the current browser supports the | |
// autoplay feature for HTML5 Audio elements, and it sets the | |
// `AUTOPLAY` variable accordingly. | |
// Used in the Meteor app [PicDinner](http://picdinner.com) |