View ClassLoader.php
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
<?php | |
/** | |
* Avaq's PSR-0 ClassLoader. | |
* | |
* @author Avaq <aldwin.vlasblom@gmail.com> | |
* | |
* 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). |
View composable-callbacks.js
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 after = t => x => cont => { | |
const id = setTimeout (cont, t, x) | |
return () => clearTimeout (id) | |
} | |
const map = f => run => cont => run(x => cont (f (x))) | |
const chain = f => run => cont => run(x => f (x) (cont)) | |
const run = chain (x => after (2000) (`${x}C`)) | |
(map (x => `${x}B`) |
View async-problem-callbacks-solution.js
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
// pipe :: Array (Any -> Any) -> Any -> Any | |
const pipe = fs => x => fs.reduce ((y, f) => f (y), x) | |
// lmap :: (a -> b) -> Array a -> Array b | |
const lmap = f => xs => xs.map (f) | |
// append :: a -> Array a -> Array a | |
const append = x => xs => [...xs, x] | |
View dates.js
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
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 |
View fold.js
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
//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; |
View directories-my.sql
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
-- Create our directories table. | |
CREATE TABLE `directories` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`name` varchar(255) DEFAULT NULL, | |
`lft` int(11) NOT NULL, | |
`rgt` int(11) NOT NULL, | |
PRIMARY KEY (`id`), | |
UNIQUE KEY `directory_lft` (`lft`), | |
UNIQUE KEY `directory_rgt` (`rgt`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
View ramda-sanctuary.md
Ramda | Sanctuary |
---|---|
add(a, b) |
add(b, a) |
addIndex(f) |
`` |
adjust(f, i, xs) |
`` |
all(f, xs) |
`` |
allPass(fs, x) |
allPass(fs, x) |
always(x) |
K(x) |
and(a, b) |
and(a, b) |
any(f, x) |
`` |
View placeholder.md
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) |
View keybase.md
Keybase proof
I hereby claim:
- I am avaq on github.
- I am avaq (https://keybase.io/avaq) on keybase.
- I have a public key ASAlzUb3ZvdW8CYnTo0SaI0TuaSBUyNS9vxUUFYFbDpgUgo
To claim this, I am signing this object:
OlderNewer