Skip to content

Instantly share code, notes, and snippets.

Travis Smith wpsmith

Block or report user

Report or block wpsmith

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wpsmith
wpsmith / s3Upload.sh
Created Jun 18, 2019
SH: Uploads file to IBM Cloud Object Storage (US Standard)
View s3Upload.sh
#!/usr/bin/env bash
# Set AWS credentials and S3 paramters
S3_KEY="YOUR_KEY_GOES_HERE"
S3_SECRET="YOUR_SECRET_GOES_HERE"
S3_BUCKET="YOUR_BUCKET_NAME_GOES_HERE"
S3_BUCKET_PATH="/"
S3_ACL="x-amz-acl:public-read"
S3_URL="https://s3.us.cloud-object-storage.appdomain.cloud/"
@wpsmith
wpsmith / taxonomies.php
Created May 30, 2012
Registering Multiple Taxonomies
View taxonomies.php
<?php
/**
* Taxonomies
*
* This file registers any custom taxonomies
*
* @package WPS_Starter_Genesis_Child
* @author Travis Smith <travis@wpsmith.net>
* @copyright Copyright (c) 2012, Travis Smith
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
@wpsmith
wpsmith / .bash_profile
Created Aug 28, 2013
SSH: .bash_profile
View .bash_profile
# =============================================================== #
#
# PERSONAL $HOME/.bashrc FILE for bash-3.0 (or later)
# By Emmanuel Rouat [no-email]
#
# Last modified: Tue Nov 20 22:04:47 CET 2012
# This file is normally read by interactive shells only.
#+ Here is the place to define your aliases, functions and
#+ other interactive features like your prompt.
@wpsmith
wpsmith / is_rest.php
Last active Jun 4, 2019
PHP: Determines whether the request is a WordPress API request.
View is_rest.php
<?php
/**
* Determines whether the current request is a RESTful request.
*
* @return bool
*/
function is_rest() {
return (
( defined( 'REST_REQUEST' ) && REST_REQUEST ) ||
@wpsmith
wpsmith / composer.json
Created May 5, 2019
CMB Autoloading with Composer
View composer.json
{
"require": {
"php": ">=5.3.0",
"composer/installers": "v1.0.12",
"webdevstudios/cmb2": "dev-master"
},
"autoload": {
"files": ["vendor/cmb2/init.php"]
},
"extra": {
View wordpress-javascript-functions.php
<?php
/*
Using the native WordPress functions and Script Manager (`WP_Scripts`).
Functions include:
wp_register_script
wp_deregister_script
wp_enqueue_script
wp_dequeue_script
wp_add_inline_script
@wpsmith
wpsmith / gist:6067068
Created Jul 23, 2013
RegEx: Notepad++ Append & Prepend to each line
View gist:6067068
Press CTRL-H to bring up the Find/Replace Dialog. Choose the "Regular expressions" checkbox near the bottom of the dialog.
To add "test" to the beginning of each line, type "^" in the "Find what" field, and "test" in the "Replace with" field. Then hit "Replace All".
To add "test" to the end of each line, type "$" in the "Find what" field, and "test" in the "Replace with" field. Then hit "Replace All".
@wpsmith
wpsmith / isotope.php
Created Nov 16, 2012
PHP: Properly Load Isotope
View isotope.php
<?php
add_action( 'wp_enqueue_scripts', 'wps_load_scripts' );
/**
* Enqueue Isotope
* For commercially developed child themes, you must obtain a license
* from isotope.metafizzy.co for approx. $25.
*
* @link http://isotope.metafizzy.co/
* @link https://github.com/desandro/isotope
* @link http://codex.wordpress.org/Function_Reference/wp_enqueue_script
@wpsmith
wpsmith / PHP composer tools.md
Created Feb 27, 2019 — forked from davebarnwell/PHP composer tools.md
Global installation of PHP tools with Composer
View PHP composer tools.md

Global installation of PHP tools with Composer

To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

$ composer global require phpunit/phpunit
$ composer global require phpunit/dbunit
$ composer global require phing/phing
$ composer global require phpdocumentor/phpdocumentor
$ composer global require sebastian/phpcpd
@wpsmith
wpsmith / gs_set_bp_profile_fw.php
Created Apr 29, 2014
PHP: Force Full-Width for BuddyPress within Genesis
View gs_set_bp_profile_fw.php
<?php
add_action( 'get_header', 'gs_set_bp_profile_fw' );
/**
* Make BuddyPress pages full width.
*
* @uses bp_current_component() Checks if current page is showing BuddyPress component.
*/
function gs_set_bp_profile_fw() {
You can’t perform that action at this time.