Skip to content

Instantly share code, notes, and snippets.

@justinwhall
justinwhall / promise-async-await.js
Last active Jan 10, 2020
Make multiple fetch request with Promise.all & async await.
View promise-async-await.js
const userUrls = [
'https://api.github.com/users/justinwhall',
'https://api.github.com/users/codeprokid',
'https://api.github.com/users/jasonbahl',
];
/**
* OPTION (A) Make multiple fetch request with Prmoise.all & async await.
*/
@justinwhall
justinwhall / .travis.yaml
Last active Feb 11, 2018
Pantheon TravisCI
View .travis.yaml
# Encrypted travis ENV vars
# $PANTHEON_UUID === Pantheon UUID
# $GIT_EMAIL === Email associated to panthoeon user (and SSH key)
sudo: false
env:
global:
- PANTHEON_SITE='pantheon-site-name'
@justinwhall
justinwhall / remove-emojis.php
Last active Jan 4, 2018
Disable WordPress Emoji's
View remove-emojis.php
<?php
/**
* No thanks on emojis.
*
* @return void
*/
function disable_wp_emojicons() {
// all actions related to emojis.
remove_action( 'admin_print_styles', 'print_emoji_styles' );
View justinwhall-scripts.php
<?php
/**
* Enqueue scripts and styles.
*/
function justinwhallv5_scripts() {
// Remove jQuery from the public side
if ( ! is_admin() ) {
wp_deregister_script( 'jquery' );
}
@justinwhall
justinwhall / gulpfile.js
Last active Jan 5, 2018
Simple Gulp dev/build
View gulpfile.js
var gulp = require( 'gulp' );
var gulpif = require( 'gulp-if' );
var browserSync = require( 'browser-sync' ).create();
var babel = require( 'gulp-babel' );
var sass = require( 'gulp-sass' );
var sourcemaps = require( 'gulp-sourcemaps' );
var autoprefixer = require( 'gulp-autoprefixer' );
var concat = require( 'gulp-concat' );
var cssnano = require( 'gulp-cssnano' );
var uglify = require( 'gulp-uglify' );
View tracktime.sql
START=$(date +%s)
# do a bunch of backup related things
END=$(date +%s)
runtime=$(($END-$START))
echo "databases.backups.$db_prefix.full $runtime `date +%s`" | nc -w 1 $graphite_url 2003
View benchmark.sql
xtrabackup: error: log block numbers mismatch:
xtrabackup: error: expected log block no. 243782669, but got no. 245879813 from the log file.
xtrabackup: error: it looks like InnoDB log has wrapped around before xtrabackup could process all records due to either log c
opying being too slow, or log files being too small.
xtrabackup: Error: xtrabackup_copy_logfile() failed.
View restoring.sql
/usr/bin/gpg2 –decrypt $backupfile.gpg > backup_file.xbs
View innobackupex.sql
innobackupex $backup_path 2>>$log_file | pigz | /usr/local/bin/gpg2 –no-default-keyring –keyring /var/lib/mysql/backup_keyring.gpg –trust-model always –encrypt –digest-algo sha512 –cipher-algo aes256 –compress-level 0 –recipient REDACTED –recipient REDACTED | ssh $remote_user@$remote_server “cat > $remote_path/$date_path/FS_$backup_file” 2>>$local_err
View .csscomb.json
{
"always-semicolon": true,
"block-indent": 2,
"color-case": "lower",
"color-shorthand": true,
"element-case": "lower",
"eof-newline": true,
"exclude": ["node_modules/**"],
"leading-zero": true,
"lines-between-rulesets": 1,