Skip to content

Instantly share code, notes, and snippets.

Aldwin Vlasblom Avaq

Block or report user

Report or block Avaq

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Avaq /
Created Jul 24, 2019
Keybase proof of Github

Keybase proof

I hereby claim:

  • I am avaq on github.
  • I am avaq ( on keybase.
  • I have a public key ASAlzUb3ZvdW8CYnTo0SaI0TuaSBUyNS9vxUUFYFbDpgUgo

To claim this, I am signing this object:

Avaq /
Last active Aug 2, 2019
Breaking Changes Upgrade Guide for Fluture version 12

Fluture v12 Upgrade Guide

Promise function reworked

See fluture-js/Fluture#331. In order to call promise on a Future, the rejection branch must now be compatible with type Error, and thrown exceptions are now merged with the rejection branch, instead of being rethrown.

This means you can now use fold and promise together to create Promises that capture exceptions, rejections, and resolutions, each in their own branch.

Anywhere you're using promise on a Future which doesn't have Error as its rejection type, you have to mapRej it to an Error type first, or fold it out of the rejection branch to avoid mixing types in your Promise rejection branch.

Avaq / directories-my.sql
Last active Feb 16, 2019
Nested Directory Structure in SQL
View directories-my.sql
-- Create our directories table.
CREATE TABLE `directories` (
`name` varchar(255) DEFAULT NULL,
`lft` int(11) NOT NULL,
`rgt` int(11) NOT NULL,
UNIQUE KEY `directory_lft` (`lft`),
UNIQUE KEY `directory_rgt` (`rgt`)
Avaq / async-problem-callbacks-solution.js
Last active Dec 20, 2017
Callback solution to the Async Problem
View async-problem-callbacks-solution.js
// 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 => (f)
// append :: a -> Array a -> Array a
const append = x => xs => [...xs, x]
# Exit with code 1 if the FILE has *modified* lines
git diff --quiet $FILE || [ $(git diff --numstat $FILE | cut -f 2) = '0' ]
# Output a visual graph of commits
git log --all --graph --pretty='format:%C(auto)%h% D%Creset %Cgreen%an, %ar%Creset %C(white)(%s)%Creset'
View composable-callbacks.js
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`)
Avaq / dangerous-promises.js
Last active Aug 4, 2019
Dangerous Promises
View dangerous-promises.js
// utils
const thrush = x => f => f(x);
const indexBy = k => xs => xs.reduce((index, x) => {
if(index[x[k]] != null) index[x[k]].push(x);
else index[x[k]] = [x];
return index;
View state-safe-mdo.js
const after = (n, x) => Future((l, r) => setTimeout(r, n, x));
const Do = (f, of) => {
return of(undefined).chain(() => {
const g = f()
const step = value => {
const result =
return result.done ?
of(result.value) :
Avaq /
Last active Mar 1, 2019
Comprehensive Ramda to Sanctuary list
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) ``
Avaq /
Last active Nov 14, 2017
A compilation of techniques for creating secure web applications
You can’t perform that action at this time.