This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if sudo. | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root." | |
exit | |
fi | |
# Change permissions of directories and all subdirectories. | |
find ./ -type d -exec chmod 755 {} \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function search($array, $key, $value) { | |
$results = array(); | |
if (is_array($array)) { | |
if (isset($array[$key]) && $array[$key] == $value) { | |
$results[] = $array; | |
} | |
foreach ($array as $subarray) { | |
$results = array_merge($results, search($subarray, $key, $value)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ -z $1 ]]; then | |
echo 'Please set a disk space limit to trigger the low disk space warning' | |
exit 1; | |
else | |
LIMIT=$1 | |
fi | |
defaults write com.apple.diskspaced minFreeSpace $LIMIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rm .gitignore | |
mv .gitignore-deploy .gitignore | |
cd wp-content/themes/standupstations/ | |
npm install | |
npm run dev | |
git config --global user.name "CodeShip deployment" | |
git config --global user.email "[email protected]" | |
git remote add staging [email protected]:production/standupstaging.git | |
git add -A | |
git commit -m "Codeship deploy" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get a product's primary category using Yoast when available. | |
*/ | |
function get_product_primary_category() { | |
global $product; | |
// if Yoast is being used, utilize it to get the primary category. | |
if ( function_exists( 'yoast_get_primary_term_id' ) ) { | |
$primary_category_id = yoast_get_primary_term_id( 'product_cat' ); | |
$category = get_term( $primary_category_id ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Disable updates for specied plugins. | |
* | |
* @param object $value Plugins update list. | |
*/ | |
function taw_disable_specified_plugin_updates( $value ) { | |
unset( $value->response['some-plugin/some-plugin.php'] ); | |
return $value; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function taw_update_all_users() { | |
$users = get_users(); | |
foreach ( $users as $user ) { | |
wp_update_user( array( 'ID' => $user->ID ) ); | |
} | |
} | |
add_action('admin_init', 'taw_update_all_users'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function change_postkey_only_once() { | |
$key = 1; | |
$option = 'change_postkey_only_once_' . $key; | |
if ( ! get_option( $option ) ) { | |
global $wpdb; | |
$query = "UPDATE " . $wpdb->prefix . "postmeta | |
SET meta_key = 'new_key_name' | |
WHERE meta_key = 'old_key_name'"; | |
$results = $wpdb->get_results($query, ARRAY_A); | |
return $results; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove filter that was added using a class function | |
* | |
* @param string $filter_name The filter hook to which the function to be removed is hooked. | |
* @param string $class_name The name of the class where the function resides. | |
* @param string $function_name The name of the function which should be removed. | |
*/ | |
function remove_filter_with_class_function( $filter_name, $class_name, $function_name ) { | |
global $wp_filter; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replace and rename table prefixes | |
* | |
* @param string $old The old table prefix to be replaced. | |
* @param string $new The new table prefix. | |
* @author Travis Aaron Wagner | |
*/ | |
function taw_replace_table_prefixes( $old, $new ) { | |
global $wpdb; |