Skip to content

Instantly share code, notes, and snippets.

View homeslicesolutions-zz's full-sized avatar
🤠
It’s happening

Joe Vu homeslicesolutions-zz

🤠
It’s happening
View GitHub Profile
@homeslicesolutions-zz
homeslicesolutions-zz / sticky-container-custom-tag.js
Last active December 6, 2016 00:23
Stick Container with a Custom Tag
import React from "react";
import {StickyContainer} from "react-sticky";
class StickyContainerCustomTag extends StickyContainer {
render() {
const tagName = this.props.tagName || 'div';
const props = {...this.props};
delete props.tagName;
@homeslicesolutions-zz
homeslicesolutions-zz / lodash_to_native.js
Last active May 19, 2020 22:32
Underscore/lodash => native
const _ = require('lodash');
// COLLECTIONS
// _.each => Array.prototype.forEach
// _.map => Array.prototype.map
// _.reduce => Array.prototype.reduce
// _.reduceRight => Array.prototype.reduceRight
// _.find => Array.prototype.find
// _.filter => Array.prototype.filter
var flattenObject = function(ob) {
var toReturn = {};
for (var i in ob) {
if (!ob.hasOwnProperty(i)) continue;
if ((typeof ob[i]) == 'object') {
var flatObject = flattenObject(ob[i]);
for (var x in flatObject) {
if (!flatObject.hasOwnProperty(x)) continue;