Skip to content

Instantly share code, notes, and snippets.

View joshcanhelp's full-sized avatar
👋
Looking for a new role

Josh Cunningham joshcanhelp

👋
Looking for a new role
View GitHub Profile
@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';
@joshcanhelp
joshcanhelp / scrollTo.js
Last active January 28, 2022 13:21
Animated scrollTo for specific element or top of page
//
// Smooth scroll-to inspired by:
// http://stackoverflow.com/a/24559613/728480
//
module.exports = function (scrollTo, scrollDuration) {
//
// Set a default for where we're scrolling to
//