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
#http://stevegrunwell.github.io/wordpress-git/#/20 | |
git ls-files -dmo --exclude-standard |
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 | |
// https://phpacademy.org/topics/how-to-insert-multiple-rows-in-mysql-in-one-query-using-pdo-from-a-form/34096 | |
function placeholder( $text, $count = 0, $separator = ',' ) { | |
$result = array(); | |
if ($count > 0) { | |
for ($x = 0; $x < $count; $x++) { | |
$result[] = $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
#set an environment variable for closure compiler | |
export CLOSURE_PATH=/usr/local/opt/closure-compiler/libexec | |
source ~/.bash_profile |
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 | |
// change the DB_HOST constant to the localhost IP address so it works on a Mac. "Localhost" means something different in a Mac environment | |
define('DB_HOST','127.0.0.1'); | |
// load the wp-load.php file to use WordPress functions. File path is assumming this is being run from the current theme folder (any theme folder would work) | |
require 'wp-load.php'; | |
require 'wp-admin/includes/plugin.php'; | |
// check if PHP is being executed from the command line | |
if( php_sapi_name() === 'cli' && defined('SWIFTYPE_AUTH_TOKEN') ){ |
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_filter( 'template_include', array( $this, 'template_additional_code') ); | |
/** | |
* Load page specific code for each template. | |
* | |
* Load additional code on a per template basis. Code in files are only useful for the particular template. | |
* | |
* @author De'Yonte W.<https://github.com/rxnlabs> |
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
//http://stackoverflow.com/questions/359788/how-to-execute-a-javascript-function-when-i-have-its-name-as-a-string | |
// http://www.sitepoint.com/call-javascript-function-string-without-using-eval/ | |
function executeFunctionByName(functionName, context, args) { | |
var args = [].slice.call(arguments).splice(2); | |
var namespaces = functionName.split("."); | |
var func = namespaces.pop(); | |
for(var i = 0; i < namespaces.length; i++) { | |
context = context[namespaces[i]]; | |
} | |
return context[func].apply(this, args); |
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 submodule add -b master link_to_git_repo_here_ssh_or_https path_to_clone_git_submodule_to_here |
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 | |
/** | |
* Move array element by index. Only works with zero-based, | |
* contiguously-indexed arrays | |
* | |
* @param array $array | |
* @param integer $from Use NULL when you want to move the last element | |
* @param integer $to New index for moved element. Use NULL to push | |
* | |
* @throws Exception |
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 first value from multidimensional serialized array | |
*/ | |
function get_value_from_multidimensional_array( $possible_array ){ | |
if( is_array($possible_array) ){ | |
$maybe_serialized = @unserialize($possible_array[0]); | |
if( $maybe_serialized !== false ){ | |
$possible_array[0] = $maybe_serialized; |
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
#initialize PHP interactive shell | |
php -a | |
require 'wp-load.php';ini_set('memory_limit',-1);require 'wp-admin/includes/admin.php';require 'wp-admin/includes/upgrade.php';wp_upgrade(); |