Skip to content

Instantly share code, notes, and snippets.

FranciscoG / custom-keys-directive.js
Last active May 28, 2020
Vue custom directive that only allows certain keys to be typed into an element that accepts keyboard input
View custom-keys-directive.js
* `v-kesAllowed` directive
* This works by blocking keys during onKeyDown by using a whitelist regex and
* testing `event.key`
* these keys should be allowed in all cases because they handle traversing and a11y
FranciscoG / hashRouther.js
Created Mar 2, 2020
A super simple hash based router component. Does very basic route path matching
View hashRouther.js
import { Component } from "preact";
class Router extends Component {
constructor() {
this.state = {
previousUrl: null,
currentRoute: window.location.hash.substring(1)
FranciscoG /
Last active Dec 13, 2019
Using adb to create screen recordings of all plugged in Android devices
# - add option to change the time limit
# - add option to change the output folder
# - add option to delete recordings on device once they have been pulled
# - figure out how to kill script when everything is done
# how many seconds to record for
FranciscoG /
Last active May 15, 2019
Convert Video to Image sequence using ffmpeg
ffmpeg -i -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:
FranciscoG / scrollIt.js
Created Nov 6, 2018
Vanilla JS scroll window to an element
View scrollIt.js
* Source:
function scrollIt(destination, duration = 200, easing = 'linear', callback) {
const easings = {
linear(t) {
return t;

mb explanation


var mb=p=>o=>>o=(o||{})[c])&&o

// in ES5:
var mb = function(pathArray) { 
  return function(obj) {  
    return { 
FranciscoG /
Created Sep 20, 2018
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"
# Colors
# Black 0;30 Dark Gray 1;30
# Blue 0;34 Light Blue 1;34
FranciscoG /
Created Aug 17, 2018
bash and other terminal related things (heavily MacOS leaning)


  • variables difference between $VAR and ${VAR}
  • find and replace in a file (sed, tr)
  • conditionals
  • loops
  • reading command line arguments
  • function arguments
  • exiting
FranciscoG / logger.js
Last active Jun 27, 2018
wrapper around all the console methods so you can turn enable/disable them.
View logger.js
"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
Hacker news:
user: tim333's js fiddle
medium post: