Skip to content

Instantly share code, notes, and snippets.

View zanematthew's full-sized avatar

Zane Matthew zanematthew

View GitHub Profile

Keybase proof

I hereby claim:

  • I am zanematthew on github.
  • I am zanematthew (https://keybase.io/zanematthew) on keybase.
  • I have a public key whose fingerprint is E819 EADC 34B1 8C07 B0BB B1C7 A95C 1EDB 1719 5D6C

To claim this, I am signing this object:

@zanematthew
zanematthew / functions.php
Created September 21, 2015 15:05
ZM ALR 2.0.0 -- Adding a new field
<?php
/**
* Adding a new field to the register form
*
* These are the steps needed to add a new field in ZM ALR (2.0.0+)
* They are as follows:
* 1. Add your field to the array of fields
* 2. Check the validation of your new field
* 3. Do something with the value AFTER successful registration
@zanematthew
zanematthew / nginx.conf
Created July 3, 2015 01:18
Block direct EDD downloads for WordPress Networking
# Block direct EDD downloads for WordPress Networking
location ~ ^/wp-content/uploads/sites/(.*)/edd/(.*?)\.zip$ {
rewrite / permanent;
}
@zanematthew
zanematthew / .bashrc
Last active August 20, 2016 19:30
The most awesome bash prompt e^er!1 // Place this code in your ~/.bash_prompt file
git_branch () { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'; }
HOST='\033[02;36m\]\h'; HOST=' '$HOST
TIME='\033[01;31m\]\t \033[01;32m\]'
LOCATION=' \033[01;34m\]`pwd | sed "s#\(/[^/]\{1,\}/[^/]\{1,\}/[^/]\{1,\}/\).*\(/[^/]\{1,\}/[^/]\{1,\}\)/\{0,1\}#\1_\2#g"`'
BRANCH=' \033[00;33m\]$(git_branch)\[\033[00m\]\n\$ '
PS1=$TIME$USER$HOST$LOCATION$BRANCH
PS2='\[\033[01;36m\]>'
fastcgi_cache_path /home/foo/site.com/cache levels=1:2 keys_zone=WORDPRESS:100m inactive=60m;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
server {
# also use www here
server_name site.com;
access_log /home/foo/site.com/logs/access.log;
error_log /home/foo/site.com/logs/error.log;
@zanematthew
zanematthew / related.php
Created June 10, 2015 13:07
The function can be placed into your functions.php, and the "usage" snippet can be used in any template/theme file.
@zanematthew
zanematthew / plugin.php
Last active August 29, 2015 14:11
Plugin Action Links
<?php
/**
* Add our links to the plugin page, these show under the plugin in the table view.
*
* @param $links(array) The links coming in as an array
* @param $current_plugin_file(string) This is the "plugin basename", i.e., my-plugin/plugin.php
*/
function my_plugin_action_links( $links, $current_plugin_file ){
if ( $current_plugin_file == 'my-plugin/plugin.php' ){
@zanematthew
zanematthew / gist:f8440442df8524a9dff0
Created December 12, 2014 17:31
Storing plugin version number on activation and deleting it during plugin deactivation.
<?php
/**
* Manging of version numbers when plugin is activated
*/
function MYPLUGIN_install() {
// Add Upgraded From Option
$current_version = get_option( MYPLUGIN_NAMESPACE . '_version' );
if ( $current_version ) {
@zanematthew
zanematthew / welcome.php
Created December 12, 2014 17:27
Note this is a snippet from a class, you can replace the $this-> with your params or hardcode them. Its all ran during admin_init.
<?php
/**
* Sends user to the start page on first activation, as well as each time the
* plugin is upgraded to a new version
*
* @access public
* @since 1.1
* @return void
*/
#!/usr/bin/env bash
#apt-get install -y git-all
## Themes
REPOS[0]='git@github.com:zanematthew/sample.git'
REPOS[1]='git@github.com:zanematthew/sample-2.git'
for repo in ${REPOS[*]}
do