Skip to content

Instantly share code, notes, and snippets.

View layflags's full-sized avatar
💥

Lay Flags layflags

💥
View GitHub Profile
@layflags
layflags / pow.js
Created January 18, 2019 11:03
Implementing JS' Math.pow functional
// recursive
const pow = (base, expo) =>
expo === 1
? base
: base * pow(base, expo - 1);
// tail recursive
const pow = (base, expo, _result = base) =>
expo === 1
? _result
@layflags
layflags / quicksort.js
Created August 15, 2018 17:54
Quicksort in ES6+
const qs = ([x, ...xs]) =>
x === undefined
? []
: [
...qs(xs.filter(a => a <= x)),
x,
...qs(xs.filter(a => a > x))
]

Keybase proof

I hereby claim:

  • I am layflags on github.
  • I am layflags (https://keybase.io/layflags) on keybase.
  • I have a public key ASBwN8wiIBnWyrK8xfiTKOI6ffFJAeFtTtjLLRwkyqG_NAo

To claim this, I am signing this object:

@layflags
layflags / hyperapp-reactor.js
Last active June 3, 2018 18:55
Port of the reactor bundle (part of HenrikJoreteg/redux-bundler) for HyperApp
import createDebug from 'debug';
/* eslint-disable no-restricted-globals */
const HAS_WINDOW = typeof window !== 'undefined';
const IS_BROWSER = HAS_WINDOW || typeof self !== 'undefined';
const ricOptions = { timeout: 500 };
// helpers
const debug = createDebug('hyperapp-reactor');
@layflags
layflags / .gitconfig
Last active February 24, 2020 10:28
my config files
[core]
excludesfile = ~/.gitignore
editor = vim
[alias]
st = status
ci = commit -v
co = checkout
br = branch
lg = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(black)%s%C(reset) %C(yellow)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
cm = "!sh -c 'git bm | grep -v \"\\*\" | grep -v master | grep -v edge | grep -v develop | xargs -n 1 git branch -d'"
@layflags
layflags / df-forward-email.js
Created June 25, 2011 21:14
Creates a new e-mail forwarder for your DomainFactory (www.df.eu) account
//
// Creates a new e-mail forwarder for your DomainFactory (www.df.eu) account
//
// Sadly DomainFactory doesn't provide an API for managing "ManagedHosting"
// accounts, so I decided to write a short script for creating e-mail
// forwarders, because I like to have one e-mail address for every service
// I register for and I don't like to waste my time clicking through several
// pages to archive this ;)
//
// To run this code you need PhantomJS - http://www.phantomjs.org/ (1.0.0)