Skip to content

Instantly share code, notes, and snippets.

View jamesmorrison's full-sized avatar

James Morrison jamesmorrison

View GitHub Profile
@jamesmorrison
jamesmorrison / wp-config.php
Last active January 11, 2021 11:17 — forked from MikeNGarrett/wp-config.php
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@jamesmorrison
jamesmorrison / gist:0de9c37135e0efe113ea14b2db00be68
Created December 17, 2020 09:24
Create a self signed TLS certificate for Local Development
#!/bin/bash
# Exit on failure
set -e
# Create the root key
openssl genrsa -out ./root.key 2048
# Generate the root certificate
openssl req -x509 -new -nodes -key ./root.key -sha256 -days 3650 -out ./root.crt -subj /C=XX/ST=LocalHost/L=LocalHost/O=LocalHost/OU=LocalHost/CN=localhost
@jamesmorrison
jamesmorrison / .gitlab-ci.yml
Created April 14, 2020 09:49
Gitlab CI configuration for DNSControl
##### Define the stages for this pipeline
stages:
- check
- preview
- deploy
##### Check
Check:
@jamesmorrison
jamesmorrison / keybase.md
Created January 25, 2019 21:16
Verify me on Keybase.io

Keybase proof

I hereby claim:

  • I am jamesmorrison on github.
  • I am jamesmorrison (https://keybase.io/jamesmorrison) on keybase.
  • I have a public key ASCOzeBwCWH4T4s-tlSOGJ8tu6ynXAHJVJAe_Vo3U5vBcQo

To claim this, I am signing this object:

@jamesmorrison
jamesmorrison / custom-query-conditional-args.php
Created January 10, 2018 11:03
Custom query with conditional taxonomy args
<?php
// Set up default query
$locations_query_args = [
'post_type' => 'locations',
'post_status' => 'publish',
'posts_per_page' => 500,
];
// Add the search query if set ($town_city_selected)
@jamesmorrison
jamesmorrison / filter-wp-basic-http-authentication-credentials.php
Last active January 5, 2018 20:12
Filter WP Basic HTTP Authentication Credentials
<?php
/**
* Plugin Name: Filter WP Basic HTTP Authentication Credentials
* Description: Filter WP Basic HTTP Authentication Credentials to use environment variables
* Author: James Morrison
* Version: 1.0.0
* Author URI: https://www.jamesmorrison.me
**/
// Filter the credentials
@jamesmorrison
jamesmorrison / filter-wp-basic-http-authentication-environments.php
Last active January 5, 2018 19:54
Filter WP Basic HTTP Authentication Environments
<?php
/**
* Plugin Name: Filter WP Basic HTTP Authentication Environments
* Description: Filter WP Basic HTTP Authentication Environments to use environment variables
* Author: James Morrison
* Version: 1.0.0
* Author URI: https://www.jamesmorrison.me
**/
// Filter the environments
@jamesmorrison
jamesmorrison / wp-basic-http-authentication.php
Last active May 21, 2019 09:41
Adding HTTP Authentication to a WordPress site
<?php
/**
* Plugin Name: WP Basic HTTP Authentication
* Plugin URI:
* Description: Adds HTTP Authentication to a WordPress site
* Author: James Morrison
* Version: 1.0.2
* Author URI: https://www.jamesmorrison.me
**/
@jamesmorrison
jamesmorrison / display-git-branch.php
Created January 3, 2018 19:29
WordPress plugin to display your Git branch in the admin bar
<?php
/**
* Plugin Name: Display Git Branch
* Version: 1.0.0
* Description: Shows which Git branch you're working on. Highlights restricted branches in red.
* Author: James Morrison
* Author URI: https://www.jamesmorrison.me/
**/
// Namespace
@jamesmorrison
jamesmorrison / 30_wpcli.config
Created November 9, 2017 22:02 — forked from Azrael808/30_wpcli.config
Elastic Beanstalk extension for installing WP CLI.
commands:
"01":
command: curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp
"02":
command: chmod +x /usr/local/bin/wp