This file contains hidden or 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
'use strict'; | |
const request = require('request'); | |
const Future = require('fluture'); | |
module.exports = o => Future((l, r) => { | |
const socket = request(o, (err, res) => err ? l(err) : r(res)); | |
return () => socket.abort(); | |
}); |
This file contains hidden or 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 S = f => g => x => f(x)(g(x)) | |
const K = x => y => x | |
const I = S(K)(K) | |
const B = S(K(S))(K) | |
const C = S(S(K(B))(S))(K(K)) | |
const A = S(K(I)) | |
const T = C(A) | |
const W = S(S)(K(I)) |
I published a library which implements this idea; furry.
# | From | To | Normal | Alternative |
---|---|---|---|---|
1 | a → b → c |
a → c |
f(_, b)(a) |
f(_, b)(a) |
2 | a → b → c |
b → a → c |
nope | f(_)(b, a) |
3 | a → b → c → d |
b → d |
f(a, _, c)(b) |
f(a, _, c)(b) |
4 | a → b → c → d |
a → b → d |
f(_, _, c)(a, b) |
f(_, _, c)(a, b) |
5 | a → b → c → d |
a → c → d |
f(_, b)(a, c) |
f(_, b, _)(a, c) |
This file contains hidden or 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
//Combinators | |
const I = x => x; | |
//List manipulation | |
const head = xs => xs[0]; | |
const tail = xs => xs.slice(1); | |
const append = x => xs => [...xs, x]; | |
//Iteration | |
const foldl = f => y => xs => xs.length > 0 ? foldl(f)(f(y)(head(xs)))(tail(xs)) : y; |
This file contains hidden or 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 I = x => x | |
const K = x => y => x | |
const A = f => x => f (x) | |
const T = x => f => f (x) | |
const W = f => x => f (x) (x) | |
const C = f => y => x => f (x) (y) | |
const B = f => g => x => f (g (x)) | |
const S = f => g => x => f (x) (g (x)) | |
const S_ = f => g => x => f (g (x)) (x) | |
const S2 = f => g => h => x => f (g (x)) (h (x)) |
This file contains hidden or 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
new Date('12 dec, 20111') //-> +020111-12-11T23:00:00.000Z | |
new Date(-1, 1) //-> -000001-01-31T23:00:00.000Z | |
new Date(-1, -1) //-> -000002-11-30T23:00:00.000Z | |
new Date(-10, 1) //-> -000010-01-31T23:00:00.000Z | |
new Date('12 dec, 000201') //-> 0201-12-11T23:00:00.000Z | |
new Date('12 dec, 201') //-> 0201-12-11T23:00:00.000Z | |
new Date('1212 dec') //-> 1212-11-30T23:00:00.000Z | |
new Date('1212 2 dec 2') //-> 1212-12-01T23:00:00.000Z | |
new Date('1212 2 dec 4') //-> 1212-12-01T23:00:00.000Z | |
new Date('1212 2 dec') //-> 1212-12-01T23:00:00.000Z |
This file contains hidden or 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
ssh user@remote gpg --export-secret-key KeyId | gpg --allow-secret-key-import --import |
This file contains hidden or 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
<?php | |
/** | |
* Avaq's PSR-0 ClassLoader. | |
* | |
* @author Avaq <[email protected]> | |
* | |
* A FIG PSR-0 class loader heavily inspired on | |
* [the official SplClassLoader](https://gist.github.com/jwage/221634) and originally | |
* developped for use in the [Forall framework](https://github.com/ForallFramework). |
NewerOlder