Skip to content

Instantly share code, notes, and snippets.

FranciscoG

Block or report user

Report or block FranciscoG

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FranciscoG
FranciscoG / convert.sh
Last active May 15, 2019
Convert Video to Image sequence using ffmpeg
View convert.sh
ffmpeg -i input.mov -r 0.25 output_%04d.png
# -i followed by video file sets input stream
# -r set framerat. 1 = 1 frame per second.
# and then set the output file with the number replacement
# more info: https://ffmpeg.org/ffmpeg.html#Main-options
# https://superuser.com/questions/135117/how-to-convert-video-to-images
@FranciscoG
FranciscoG / scrollIt.js
Created Nov 6, 2018
Vanilla JS scroll window to an element
View scrollIt.js
/**
* Source: https://pawelgrzybek.com/page-scroll-in-vanilla-javascript/
*/
function scrollIt(destination, duration = 200, easing = 'linear', callback) {
const easings = {
linear(t) {
return t;
},
View mb-explanation.md

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 Sep 20, 2018
Simple shell script to add a new site to my local macOS LAMP stack
View addSite.sh
#!/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
Created Aug 17, 2018
bash and other terminal related things (heavily MacOS leaning)
View my-cheatsheet.md

TODO:

  • variables difference between $VAR and ${VAR}
  • find and replace in a file (sed, tr)
  • conditionals
  • loops
  • reading command line arguments
  • function arguments
  • exiting
@FranciscoG
FranciscoG / logger.js
Last active Jun 27, 2018
wrapper around all the console methods so you can turn enable/disable them.
View logger.js
(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){
View displayZeroWidthChars.js
/*
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 Sep 12, 2019
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
View acf_repeater_shortcode.php
<?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
Created Jan 29, 2018
a collection of mini functions that return special characters from their character codes in Javascript
View specialChar.js
/* Special Characters */
// <
// less-than sign
const lt = () => String.fromCharCode(60);
// >
// greater-than sign
const gt = () => String.fromCharCode(62);
// "
@FranciscoG
FranciscoG / SimpleServer.js
Last active Oct 18, 2017
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
View SimpleServer.js
/**
* 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
*
You can’t perform that action at this time.