Skip to content

Instantly share code, notes, and snippets.

View jkempff's full-sized avatar
👻

jkempff

👻
View GitHub Profile
@jkempff
jkempff / schoenfinkelize.js
Created July 2, 2013 16:48
Schönfinkelize
function schonfinkelize (fn) {
var slice = Array.prototype.slice,
defaults = slice.call(arguments,1);
return function () {
var new_args = slice.call(arguments),
args = defaults.concat(new_args);
return fn.apply(null,args);
}
}
@jkempff
jkempff / blink.fallback.js
Created August 9, 2013 14:11
Brings back the good old HTML <blink> tag.
@jkempff
jkempff / simple-sass-grid.scss
Last active August 29, 2015 14:08
Simple sass grid mixin
/*doc
---
title: Grid System
name: grid
category: base
---
A very basic grid system that supports **2-, 3-, 4- and 5-column** layouts.
Inspired by [oocss](http://oocss.org/).
@jkempff
jkempff / silverstripe-custom-admin-redirect.yml
Created June 1, 2015 14:24
Silverstripe redirect after CMS login
---
Name: my-config
After:
- 'framework/*'
- 'cms/*' # this is optional
---
# Simply set the `AdminRootController`s `default_panel`
# to your own controller or ModelAdmin
AdminRootController:
default_panel: 'MyModelAdmin'
var fetchWithCache = (function () {
var cache = {};
const doFetch = (url, options) => {
return cache[url] ? cache[url] : cache[url] = fetch(url, options)
.then(response => response.json());
};
doFetch.flush = () => (cache = {}, true);
return doFetch;
}());

Keybase proof

I hereby claim:

  • I am jkempff on github.
  • I am jkempff (https://keybase.io/jkempff) on keybase.
  • I have a public key ASDh5BGIDyJlv3-XDUjNxGPZENNpe8qfHYLEjbc6w2orpwo

To claim this, I am signing this object:

@jkempff
jkempff / EventRecorder.js
Created May 11, 2018 16:17
Records DOM-events and replays them on demand. Nice for server side rendered pages: record during page-load, replay after all javascript was initialized.
/**
* EventRecorder
* @class
* @classdesc An EventRecorder can record and replay any event on any DOM node
* @param {string} [eventName=click] - Name of the events to record
* @param {class} [EventClass=MouseEvent] - The class that should be used to recreate the events
* @param {object} [context=self] - The context DOM element, the events should be fetched from
* @example
* // Create a recorder for click events
* const clickRecorder = new EventRecorder('click', MouseEvent, window);
@jkempff
jkempff / SketchSystems.spec
Last active June 15, 2018 12:02
derkonzert community
derkonzert community
View Concerts
add-new -> Add Concert
Add Concert
Enter Name
enter-name -> Enhance Concert Data
enter-existing-name -> Concert might already be present
Enhance Concert Data
enhance-concert-data -> Enhance Concert Data
@jkempff
jkempff / eventIterator.js
Created July 23, 2020 07:14
Async generator for DOM events
async function* eventIterator(element, eventName, subscribed) {
while(true) {
yield new Promise(resolve => {
const listener = e => {
element.removeEventListener(eventName, listener);
resolve(e);
};
element.addEventListener(eventName, listener);
})