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
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
//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
<?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
<?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
#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 | |
// 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
#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
#place above all other rewrite rules if using a cms or program that redirects all request to index.php file (e.g. WordPress, Drupal, Laravel, etc...) | |
#if a file or directory does not exist on the local host, 302 redirect the request to the production host so the browser doesn't cache the file in case you replace the file locally | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
#Redirect WordPress uploads | |
#Prevent infinite redirect. Only apply this if not on any subdomains of the live domain. Comment out line if not needed | |
RewriteCond %{HTTP_HOST} !^(.*)example\.com | |
#Prevent infinite redirect. Only apply this if not on the root domain of the live domain. Uncomment line if needed | |
#RewriteCond %{HTTP_HOST} !^example\.com [NC] | |
#Prevent infinite redirect. Only apply this if not on the www version of the exact domain of the live domain. Uncomment line if needed |
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
doskey wp=php D:\devtools\wp-cli\wp-cli.phar |