source: https://github.com/burakcan/mb
var mb=p=>o=>p.map(c=>o=(o||{})[c])&&o
// in ES5:
var mb = function(pathArray) {
return function(obj) {
return pathArray.map(function(c) {
/** | |
* Source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/ | |
*/ | |
function scrollIt(destination, duration = 200, easing = 'linear', callback) { | |
const easings = { | |
linear(t) { | |
return t; | |
}, |
source: https://github.com/burakcan/mb
var mb=p=>o=>p.map(c=>o=(o||{})[c])&&o
// in ES5:
var mb = function(pathArray) {
return function(obj) {
return pathArray.map(function(c) {
#!/usr/bin/env bash | |
if [ "$EUID" -ne 0 ] | |
then echo "You must use sudo to run this script" | |
exit | |
fi | |
# Colors | |
# Black 0;30 Dark Gray 1;30 | |
# Blue 0;34 Light Blue 1;34 |
(function(window){ | |
"use strict"; | |
/** | |
* Wrap console methods to turn them on/off with a flag | |
* Plus stub console methods for older browsers without console | |
* | |
* @param {boolean} debugFlag | |
*/ | |
function Logger(debugFlag){ |
/* | |
Traverse through all the Text Nodes in a page and force them to display hidden characters | |
Sources: | |
Hacker news: https://news.ycombinator.com/item?id=16749422 | |
user: tim333's js fiddle https://jsfiddle.net/tim333/np874wae/13/ | |
medium post: https://medium.com/@umpox/be-careful-what-you-copy-invisibly-inserting-usernames-into-text-with-zero-width-characters-18b4e6f17b66 | |
TODO: |
<?php | |
/** | |
* ACF Pro repeater field shortcode | |
* | |
* I created this shortcode function because it didn't exist and it was being requested by others | |
* I originally posted it here: https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/ | |
* | |
* @attr {string} field - (Required) the name of the field that contains a repeater sub group | |
* @attr {string} sub_fields - (Required) a comma separated list of sub field names that are part of the field repeater group | |
* @attr {string} post_id - (Optional) Specific post ID where your value was entered. Defaults to current post ID (not required). This can also be options / taxonomies / users / etc |
/* Special Characters */ | |
// < | |
// less-than sign | |
export const lt = () => String.fromCharCode(60); | |
// > | |
// greater-than sign | |
export const gt = () => String.fromCharCode(62); | |
// " |
/** | |
* Simple Node Server | |
* | |
* When you need a quick and dirty node server to do some experimenting/testing with | |
* but you don't want to install a whole Framework and its many many dependencies | |
* and you want something easy to extend | |
* | |
* WARNING: This is not meant to be used in production! | |
* I created this partly for learning node and partly for prototyping | |
* |