Skip to content

Instantly share code, notes, and snippets.

View skovhus's full-sized avatar

Kenneth Skovhus skovhus

View GitHub Profile
/**
* @link https://raw.githubusercontent.com/NaturalCycles/js-lib/master/src/promise/pProps.ts
* Promise.all for Object instead of Array.
*
* Inspired by Bluebird Promise.props() and https://github.com/sindresorhus/p-props
*
* Improvements:
*
* - Exported as { promiseProps }, so IDE auto-completion works
@tlrobinson
tlrobinson / redux-devtools-separate-window.js
Last active August 20, 2019 23:54
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
// give it a name so it reuses the same window
var win = window.open(null, "redux-devtools", "menubar=no,location=no,resizable=yes,scrollbars=no,status=no");
// reload in case it's reusing the same window with the old content
win.location.reload();
// wait a little bit for it to reload, then render
setTimeout(function() {
React.render(
<DebugPanel top right bottom left >
@briancavalier
briancavalier / simple-promise-retry.js
Created February 24, 2011 18:35
A few general patterns for retries using promises
function keepTrying(otherArgs, promise) {
promise = promise||new Promise();
// try doing the important thing
if(success) {
promise.resolve(result);
} else {
setTimeout(function() {
keepTrying(otherArgs, promise);