Skip to content

Instantly share code, notes, and snippets.

View jzDev's full-sized avatar
😀
Hello!

Johnny Zarate jzDev

😀
Hello!
View GitHub Profile
@jzDev
jzDev / reduxReducerRegistry.js
Created September 25, 2018 06:29
Redux reducer registry to dynamically add reducers
const placeholderReducer = (state = null) => state;
let reducers = {};
export default {
getReducers() {
return { ...reducers };
},
// Preserve initial state for not-yet-loaded reducers
getInitialReducer(initialReducers, initialState) {
const reducerNames = Object.keys(initialReducers);
@jzDev
jzDev / checkIfSuperBalancedTree.js
Last active June 2, 2020 04:38
Write a function to see if a binary tree is "superbalanced"
class BinaryTreeNode {
constructor(value) {
this.value = value;
this.left = null;
this.right = null;
}
insertLeft(value) {
this.left = new BinaryTreeNode(value);
return this.left;