Skip to content

Instantly share code, notes, and snippets.

View sebringj's full-sized avatar
💭
Shet yer Shtatus

Jason Sebring sebringj

💭
Shet yer Shtatus
View GitHub Profile
@sebringj
sebringj / getKeyList.js
Last active June 21, 2017 15:59
JavaScript getKeyList
/*
use like so:
let keyList = getKeyList("a", "b", "c")
console.log(keyList[0]) // "a"
console.log(keyList.index["a"]) // 0
*/
function getKeyList() {
let arr = [].slice.call(arguments);
@sebringj
sebringj / LookupList.js
Last active June 21, 2017 15:35
JavaScript LookupList
/*
use like so:
const lookupList = new LookupList({ a: 1 }, { b: 2 }, { c: 3 })
console.log(lookupList.valueByKey('a')) // 1
console.log(lookupList.keyByValue(1)) // "a"
console.log(lookupList.keysByValue(1)) // ["a"]
console.log(lookupList.valueByIndex(0)) // 1
console.log(lookupList.keyByIndex(0)) // "a"
@sebringj
sebringj / promiseMapAll.js
Last active May 3, 2017 06:55
maps Promise.all
async function promiseMapAll(promiseMap) {
const keys = Object.keys(promiseMap);
const promises = keys.map(key => promiseMap[key]);
const promisesArr = await Promise.all(promises);
let objMapped = {};
keys.forEach((key, i) => {
objMapped[key] = promisesArr[i];
});
return objMapped;
}
@sebringj
sebringj / TinyStore.js
Last active May 2, 2017 14:27
Tiny Flux Store for React
class TinyStore {
constructor(key) {
this._events = {};
this._data = undefined;
this._key = key;
}
on(evt, fn) {
let list = this._events[evt] = this._events[evt] || [];
for (let fnItem of list)

Keybase proof

I hereby claim:

  • I am sebringj on github.
  • I am jasonsebring (https://keybase.io/jasonsebring) on keybase.
  • I have a public key whose fingerprint is C7D8 CC6F F1DB 9014 9A6A E34E C7D8 74CD 6848 F3EE

To claim this, I am signing this object:

'use strict';
var _ = require('lodash');
var React = require('react');
var ReactDOM = require('react-dom');
var THROTTLE_TIME = 250;
var InfiniteChild = React.createClass({
getInitialState: function() {
info: Welcome to Nodejitsu
info: jitsu v0.9.8
info: It worked if it ends with Nodejitsu ok
info: Executing command users confirm zipstory edb7fe3a-56e8-4442-8423-e90c105ea543
info: Confirming user zipstory
error: Error running command users confirm zipstory edb7fe3a-56e8-4442-8423-e90c105ea543
error: Nodejitsu Error (400): Bad Request
error: connect ECONNREFUSED
help: For help with this error contact Nodejitsu Support:
help: webchat: <http://webchat.nodejitsu.com/>