Skip to content

Instantly share code, notes, and snippets.

mb explanation

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) { 
@FranciscoG
FranciscoG / addSite.sh
Created September 20, 2018 23:35
Simple shell script to add a new site to my local macOS LAMP stack
#!/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
@FranciscoG
FranciscoG / my-cheatsheet.md
Last active October 29, 2021 14:42
bash and other terminal related things (heavily MacOS leaning)
@FranciscoG
FranciscoG / logger.js
Last active June 27, 2018 14:07
wrapper around all the console methods so you can turn enable/disable them.
(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:
@FranciscoG
FranciscoG / acf_repeater_shortcode.php
Last active April 18, 2024 00:00
An Advanced Custom Fields shortcode that allows to loop through a field with a repeater. This only handles simple cases, it can't handle nested repeater fields
<?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
@FranciscoG
FranciscoG / specialChar.js
Last active May 4, 2022 09:20
a collection of mini functions that return special characters from their character codes in Javascript
/* Special Characters */
// <
// less-than sign
export const lt = () => String.fromCharCode(60);
// >
// greater-than sign
export const gt = () => String.fromCharCode(62);
// "
@FranciscoG
FranciscoG / SimpleServer.js
Last active October 18, 2017 22:12
Work in Progress: A very very simplified Node server in the style of Express. Not to be used in production, meant for experimenting and testing
/**
* 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
*
@FranciscoG
FranciscoG / GIF-Screencast-OSX.md
Created June 1, 2017 18:45 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@FranciscoG
FranciscoG / README.md
Last active October 23, 2020 07:42
¯\_(ツ)_/¯

Shrug Emoji inserter

This is how I have it setup where I click on an item in the OSX top menu. You could probably do something like trigger it with a key combo but you'll have to figure that out on your own. I'm fine with this approach.

Step 1:

Take either of the .scpt files below and save the script to your ~/Library/Scripts folder
Note: The shrug-JXA.scpt only works in OSX 10.10 and above (including MacOS)