Skip to content

Instantly share code, notes, and snippets.

View jrobinsonc's full-sized avatar
🎯
Focusing

Jose Robinson jrobinsonc

🎯
Focusing
View GitHub Profile
@jrobinsonc
jrobinsonc / sw-await.js
Last active May 7, 2020 12:22 — forked from bakoushin/sw-await.js
Service Worker: Promises vs Async/Await
const version = 1;
const appPrefix = 'myApp-';
const staticCacheName = appPrefix + 'static-v' + version;
const imagesCacheName = appPrefix + 'content-imgs';
var allCaches = [
staticCacheName,
imagesCacheName
];
self.addEventListener('message', event => {
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@jrobinsonc
jrobinsonc / ask.sh
Created January 2, 2019 20:00
Bash General-Purpose Yes/No Prompt Function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# https://gist.github.com/davejamesmiller/1965569
local prompt default reply
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@jrobinsonc
jrobinsonc / _readme.md
Created February 13, 2018 05:22 — forked from lambdahands/_readme.md
FlowType and CSS Modules

Huh?

So basically FlowType doesn't know about CSS Modules, a really handy way of dealing with the plagues of CSS in codebases (global variables and dependency wackiness mainly).

What WebPack allows us to do is "require" CSS files and use their class names:

import styles from "my_styles.css";
import React from "react";
@jrobinsonc
jrobinsonc / php.sublime-build
Created October 18, 2017 15:53 — forked from fabiobruna/php.sublime-build
PHP Lint build system for Sublime Text 3
{
"cmd": ["php", "-l", "$file"],
"file_regex": "^.* in (...*?) on line ([0-9]*)",
"selector": "source.php"
}
@jrobinsonc
jrobinsonc / README.md
Last active October 15, 2018 12:33 — forked from Greg-Boggs/README.md
Drupal Site Building Best Practices

Better Drupal Building

  • Custom glue should be accomplished with configuration first and PHP code second.

Configuration Management and Dependencies

  • Use Composer (or Drush Make) to build your project and it's depencies.
  • Store your work in files.
  • Set your config directory above the webroot.
  • Sync UUIDs across all developers.

Theming

@jrobinsonc
jrobinsonc / PHP composer tools.md
Created September 8, 2017 03:03 — forked from davebarnwell/PHP composer tools.md
Global installation of PHP tools with Composer

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@jrobinsonc
jrobinsonc / vagrant-vbox-guestadditions.txt
Last active October 13, 2016 15:06 — forked from zbal/gist:7800423
Vagrant: Repair VirutalBox GuestAdditions
# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
{"1":{"Pais":"Republica Dominicana","Provincia":{"1":{"Nombre":"Distrito Nacional","Capital":"Santo Domingo de Guzmán"},"2":{"Nombre":"Azua","Capital":"Azua de Compostela","Municipio":{"1":{"Nombre":"Azua de Compostela","Distrito":{"1":"Barreras ","2":"Barro Arriba ","3":"Clavellina ","4":"Emma Balaguer Viuda Vallejo ","5":"Las Barías-La Estancia ","6":"Las Lomas ","7":"Los Jovillos ","8":"Puerto Viejo"}},"2":{"Nombre":"Estebanía"},"3":{"Nombre":"Guayabal"},"4":{"Nombre":"Las Charcas","Distrito":{"9":"Hatillo ","10":"Palmar de Ocoa"}},"5":{"Nombre":"Las Yayas de Viajama","Distrito":{"11":"Villarpando ","12":"Hato Nuevo-Cortés"}},"6":{"Nombre":"Padre Las Casas","Distrito":{"13":"La Siembra ","14":"Las Lagunas ","15":"Los Fríos"}},"7":{"Nombre":"Peralta"},"8":{"Nombre":"Pueblo Viejo","Distrito":{"16":"El Rosario"}},"9":{"Nombre":"Sabana Yegua","Distrito":{"17":"Proyecto 4 ","18":"Ganadero ","19":"Proyecto 2-C"}},"10":{"Nombre":"Tábara Arriba","Distrito":{"20":"Amiama Gómez ","21":"Los Toros ","22":"Tábara Abajo