Skip to content

Instantly share code, notes, and snippets.

View joshcanhelp's full-sized avatar
🌠
Looking for the next thing!

Josh Cunningham joshcanhelp

🌠
Looking for the next thing!
View GitHub Profile
@joshcanhelp
joshcanhelp / copy-tags-to-wp-svn.sh
Last active June 6, 2018 17:36
Copy git repo tags to an svn directory
#!/bin/sh
# Change "grep ^3." to filter by a different major (or remove)
# Change "~/Sites/wp-svn" to the correct path to your local svn repo
# Change rsync excludes, if needed
# Run this in a git repo with tags
for f in $(git tag -l | grep ^3.); do git checkout tags/"$f"; rsync -rv --exclude .git --exclude vendor ./ ~/Sites/wp-svn/tags/"$f"; done
@joshcanhelp
joshcanhelp / generate-wp.sh
Last active July 2, 2018 23:18
Generate a WP instance locally - WIP
#!/bin/sh
# #########
# Variables
# #########
WORKING_DIR="/Users/josh-cunningham/Sites/wordpress-test-fixture"
DB_NAME="wordpress_test_fixture"
DB_USER="root"
DB_HOST="localhost"
@joshcanhelp
joshcanhelp / wp_auth0_default_settings.json
Created May 7, 2018 20:08
Default WP-Auth0 settings for reset
{
"version":1,
"last_step":1,
"migration_token_id":null,
"use_lock_10":true,
"jwt_auth_integration":0,
"amplificator_title":"",
"amplificator_subtitle":"",
"connections":[],
"auth0js-cdn":"https:\/\/cdn.auth0.com\/js\/auth0\/9.4\/auth0.min.js",
@joshcanhelp
joshcanhelp / wp-env.php
Last active April 24, 2018 21:36
Get WordPress environment telemetry
function get_wp_env() {
$server_software = filter_input( INPUT_SERVER, 'SERVER_SOFTWARE', FILTER_SANITIZE_STRING );
if ( $server_software ) {
$server_software = explode( ' ', trim( $server_software ) );
$server_software = $server_software[0];
} else {
$server_software = __( 'unknown', 'wp-auth0' );
}
try {
@joshcanhelp
joshcanhelp / generate_wp_environment.sh
Created April 18, 2018 21:51
Generate a WP-Auth0 testing platform with PHP and MySQL already installed
#!/usr/bin/env bash
#
# Check for flags
#
# -d will use all default values
USE_DEFAULTS=false;
# -r will reset the install first (delete the DB and files)
@joshcanhelp
joshcanhelp / auth0-styleguide.scss
Created April 10, 2018 23:24
Auth0 Styleguide SCSS include
// Primary colors
// http://styleguide.auth0.com/#/design/primary-colors
$color-red: #EB5424;
$color-blue-light: #44C7F4;
$color-blue: #16214D;
$color-yellow: #EACA2C;
// Secondary colors
// http://styleguide.auth0.com/#/design/secondary-colors
@joshcanhelp
joshcanhelp / wp-auth0-hook.php
Created March 29, 2018 17:55
Append a cache-breaking parameter to login_url redirects
/**
* Append a cache-breaking parameter to login_url redirects
*
* @param string $login_url
* @param string $redirect
*
* @return string
*/
function wp_auth0_gist_cache_break_redirect_to( $login_url, $redirect ) {
if ( ! empty( $redirect ) ) {
/**
* Find next available server number
*
* @param servers
*
* @return {int}
*/
function next_server_number( servers ) {
'use strict';
@joshcanhelp
joshcanhelp / WPRemoveComments.php
Created March 1, 2017 20:07
WordPress: remove comment support completely
<?php
/**
* Completely nuke comments support
* Need to also also turn off comments/pingbacks at wp-admin > Settings > Discussion
* Need to also turn off comments for posts individually (Bulk Edit or DB find/replace)
*
* Adapted from: https://www.dfactory.eu/wordpress-how-to/turn-off-disable-comments/
*
* @package WordPress
@joshcanhelp
joshcanhelp / parseUrlParams.js
Last active February 5, 2017 03:39
Get the various parameters from a URL piece, hash or query
/**
* Get the various parameters from a URL piece, hash or query
*
* @param params
*
* @returns {{}}
*/
function parseUrlParams( params ) {
'use strict';