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
#!/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
<?php | |
/** | |
* Automatically loads plugins in folders | |
* | |
* @package mu-plugin-autoloader | |
*/ | |
$dirs = array_filter( glob( WPMU_PLUGIN_DIR . '/*' ), 'is_dir' ); | |
foreach ( $dirs as $dirpath ) { | |
$regex = '/([^\/]+$)/'; |
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
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done |
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 | |
/** | |
* Add WordPress User | |
* | |
* @package taw | |
*/ | |
/** | |
* Add WordPress Admin User | |
*/ |
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 | |
/** | |
* Class: Example Module | |
* | |
* @package projectname | |
* @subpackage modules | |
*/ | |
/** | |
* Example Module |
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 parse_args( $args, $defaults = '' ) { | |
if ( is_object( $args ) ) { | |
$r = get_object_vars( $args ); | |
} elseif ( is_array( $args ) ) { | |
$r =& $args; | |
} else { | |
parse_str( $args, $r ); | |
} |
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
add_filter( 'wp_trim_excerpt', 'awesome_excerpt', 10, 2 ); | |
function awesome_excerpt($text, $raw_excerpt) { | |
if( ! $raw_excerpt ) { | |
$content = apply_filters( 'the_content', get_the_content() ); | |
$text = substr( $content, 0, strpos( $content, '</p>' ) + 4 ); | |
} | |
return $text; | |
} |
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 | |
# NOTE: this file needs to have write and execute permissions (chmod u+x ./deploy.sh) | |
set -e | |
DEV_PATH="/home/wpe-user/sites/corpmember3/wp-content" | |
PRO_PATH="/home/wpe-user/sites/corpmember/wp-content" | |
DEV_SSH="[email protected]" | |
PRO_SSH="[email protected]" | |
DEPLOY_IGNORE="./.deployignore" |
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
language: node_js # use 'generic' if not compiling anything | |
node_js: | |
- "node" | |
cache: npm | |
env: | |
global: | |
- DEVELOPMENT_PATH="/full/path/to/dev/deployment/directory" | |
- PRODUCTION_PATH="/full/path/to/production/deployment/directory" | |
- SSH_USER="username" | |
- SSH_HOST="example.com" |