Skip to content

Instantly share code, notes, and snippets.

View mturnwall's full-sized avatar

Michael Turnwall mturnwall

View GitHub Profile
@mturnwall
mturnwall / getObjValue.js
Created September 30, 2020 22:34
Function to get a value from an object regardless of the object's depth
/**
*
* @param {Object} obj - the object you want to get a value out of
* @param {Array | String} path - the path to the value, can either be an array `['a', 'b', 'c']` of keys or
* string using dotnotation `a.b.c`
* @param {*} [defaultValue=undefined] the value you want to return if the key is not found in the object
*/
const getObjValue = (obj, path, defaultValue) => {
let checkedPath = path;
if (!Array.isArray(checkedPath)) {
@monostere0
monostere0 / GlobalEvents.js
Last active February 19, 2020 08:10
Fire events between different browser windows using localStorage.
(function(window){
var EVENT_EXISTS = 'GlobalEvents: Event already exists.';
var eventIsRunning,
_eventStack,
_findByName,
stackEvent,
removeEvent,
eventListener,
@davidpett
davidpett / _ease.scss
Last active December 13, 2023 22:49
Easing Equations as SCSS variables
/*
* Easing Equations ported to CSS by @matthewlein - http://matthewlein.com/ceaser/
* Converted to SCSS vars by @pettpett
*
* sample usage:
* a {
* color: #ff0000;
* transition: color 0.5s $easeOutQuint;
* &:hover,