Skip to content

Instantly share code, notes, and snippets.

View tkers's full-sized avatar
🍒

Tijn Kersjes tkers

🍒
View GitHub Profile
@tkers
tkers / moscow.bash
Last active August 29, 2015 14:23
Bash MoSCoW
# Introducting MoSCoW for bash:
function must {
# Exit on errors
"$@" || exit $?
}
function should {
# Warn on errors
"$@" || echo "[!] Failed running $@"
}
function could {
@tkers
tkers / rpc.js
Last active October 1, 2015 13:35
/**
* Konnektid - rpc
*
* Copyright(c) 2015 Konnektid
* All rights reserved.
*
* Simple function to communicate with the API without all the
* bullshit that I made up when creating the original API.js module.
* Only handles setting up the correct headers and parsing the data.
*
{
"env": {
"es6": true
},
"plugins": [
"react"
],
"ecmaFeatures": {
"jsx": true,
"experimentalObjectRestSpread": true
// comp :: (F, G, H) => (x, y, z) => F(G(H(x, y, z)))
const comp = (...fns) => (...args) => fns.reduceRight((arg, fn) => [fn(...arg)], args)[0];
// const composed = composeMiddleware(fn1, fn2, fn3);
const composeMiddleware = (head, ...tail) => (req, res, next) =>
head instanceof Function ?
head(req, res, () => composeMiddleware(...tail)(req, res, next)) :
next();
// var composed5 = composeMiddlewareES5([fn1, fn2, fn3]);
var composeMiddlewareES5 = funcs => (req, res, next) =>
funcs[0] instanceof Function ?
funcs[0](req, res, () => composeMiddlewareES5(funcs.slice(1))(req, res, next)) :
@tkers
tkers / keybase.md
Created September 5, 2016 21:03
Keybase identify prove

Keybase proof

I hereby claim:

  • I am lapixx on github.
  • I am tijn (https://keybase.io/tijn) on keybase.
  • I have a public key ASDTeIUSPo0yYMuq0weEcEWZ2lNePRvN-WX6XMyT03rNWgo

To claim this, I am signing this object:

/*
Removes empty constructors (ignoring calls to super)
Run with codeshift:
jscodeshift -t ./remove-empty-constructor.js --extensions js,jsx --ignore-pattern 'node_modules' src/
*/
export default function transformer(file, api) {
const j = api.jscodeshift
const root = j(file.source)
/*
Moves this.state assignment in constructor to class property
Run with codeshift:
jscodeshift -t ./constructor-state-to-class-property.js --extensions js,jsx --ignore-pattern 'node_modules' src/
*/
export default function transformer(file, api) {
const j = api.jscodeshift
const root = j(file.source)
@tkers
tkers / XMLReport.java
Created January 29, 2019 15:39
Cobertura XML reporter
/*
* Cobertura - http://cobertura.sourceforge.net/
*
* Copyright (C) 2003 jcoverage ltd.
* Copyright (C) 2005 Mark Doliner
* Copyright (C) 2005 Jeremy Thomerson
* Copyright (C) 2006 Jiri Mares
* Copyright (C) 2008 Julian Gamble
*
* Cobertura is free software; you can redistribute it and/or modify
Package: libws-commons-util-java
Status: install ok installed
Priority: optional
Section: java
Installed-Size: 101
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: all
Version: 1.0.1-7
Description: Common utilities from the Apache Web Services Project
This is a small collection of utility classes, that allow high