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 / browser-language-codes.js
Created Nov 22, 2013
JS: Object of Browser Language Codes
View browser-language-codes.js
// <![CDATA[
var langCodes = {
"af": "Afrikaans",
"sq": "Albanian",
"ar": "Arabic (Standard)",
"ar-dz": "Arabic (Algeria)",
"ar-bh": "Arabic (Bahrain)",
"ar-eg": "Arabic (Egypt)",
"ar-iq": "Arabic (Iraq)",
"ar-jo": "Arabic (Jordan)",
@wpsmith
wpsmith / New-ErrorRecord.ps1
Created Apr 16, 2015
PowerShell: Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
View New-ErrorRecord.ps1
<#
.Synopsis
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Description
Creates an custom ErrorRecord that can be used to report a terminating or non-terminating error.
.Parameter Exception
The Exception that will be associated with the ErrorRecord.
@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 / WPS_Extend_Plugin.php
Last active Apr 19, 2019
PHP: WPS_Extend_Plugin Class designed to declare a plugin dependency and used for extending a plugin.
View WPS_Extend_Plugin.php
<?php
/**
* Contains WPS_Extend_Plugin class. and wps_extend_plugins function.
*
* @package WPS_Core
* @author Travis Smith <t@wpsmith.net>
* @copyright 2015 WP Smith, Travis Smith
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
* @version 1.0.0
* @since File available since Release 1.0.0
You can’t perform that action at this time.