Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Jason Gretz jagretz

🎯
Focusing
Block or report user

Report or block jagretz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jagretz
jagretz / .hyper
Created Feb 12, 2019
hyper-term settings-sync
View .hyper
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: "stable",
@jagretz
jagretz / intersperse.js
Created Dec 25, 2018
Create and return a new array with the separator interposed between elements; intersperse :: a -> [a] -> [a]
View intersperse.js
/**
* Create and return a new array with the separator interposed between elements.
*
* intersperse :: a -> [a] -> [a]
*
* Providing the separator as the first argument allows this method to be easily
* curried and composed with other functions; follows the "data last" approach.
*
* @param {*} separator
* @param {*} array
View createActionType.js
export const APP = "r3";
export const createActionType = app => duck => type => `${app}/${duck}/${type}`;
export const createDuckType = createActionType(APP);
/**
* Constructs a new action with a required type and optional additional action properties supplied as
* optional argument(s*); *see `...rest` param below.
*
@jagretz
jagretz / reducerDictionary.js
Last active Oct 19, 2018
Minimize reducer boilerplate by utilizing a function that searches a dictionary of action types mapped to corresponding action creators
View reducerDictionary.js
/**
* @file example of a reducer dictionary where action types are tied to
* reducer functions mapped in a dictionary object.
*/
import propOr from "ramda/src/propOr";
/* Action Types */
const GET_STORE_SUCCESS = "app/reducer/actiontype";
@jagretz
jagretz / EventEmitter.js
Created May 28, 2018
Custom EventEmitter for created for the purpose of learning and teaching others.
View EventEmitter.js
// Example on codepen https://codepen.io/jagretz/pen/aGeMoJ
// If you would like a production version, use complete, tested, performant, and
// well-supported version https://github.com/facebook/emitter
/**
* Subscribe to and control when events are emitted to subscribers.
*/
class EventEmitter {
constructor() {
// k,v store of events to subscribers.
@jagretz
jagretz / reduceReducers.js
Created Apr 18, 2018
Reduce multiple reducer functions passing state and action through each in sequence.
View reduceReducers.js
/**
* Supply multiple reducer functions, as arguments, and return a new reducer function that pipes the
* state and action through each reducer in sequence.
* @param {...functions} reducers like (arg1, arg2, ...), as a serires of arguments.
* @return {function} a new reducer function that pipes the state and action through each reducer in sequence.
* Each successive reducer will receive the updated returned by the previous reducer.
*/
export default function reduceReducers(...reducers) {
return (currentState = {}, action = {}) =>
reducers.reduce((updatedState, red) => red(updatedState, action), currentState);
@jagretz
jagretz / cloudSettings
Last active Dec 3, 2019
vsCode Settings Sync Gist
View cloudSettings
{"lastUpload":"2019-12-03T16:20:48.618Z","extensionVersion":"v3.4.3"}
You can’t perform that action at this time.