This file contains 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
WP headers api for for POST from localhost:3000: | |
<?php | |
// init hook as will be global. send_headers hook doesn't work on rest api. | |
add_action( 'init', [ $this, 'security_headers' ] ); | |
// DEBUG_MODE_CLIENT_URL = http://localhost:3000 | |
public function security_headers() { | |
if ( defined( 'DEBUG_MODE_CLIENT_URL' ) ) { | |
header("Access-Control-Allow-Origin: " . DEBUG_MODE_CLIENT_URL); |
This file contains 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
/** | |
* Determine if it's a REST API request. | |
* | |
* @return boolean True if rest request. | |
*/ | |
function is_rest() { | |
return defined( 'REST_REQUEST' ) && REST_REQUEST; | |
} | |
/** |
This file contains 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
/** | |
* Start point for CLI command to process some posts in batches | |
* | |
* ## EXAMPLES | |
* | |
* wp mycommand | |
* | |
* @subcommand process-posts | |
* | |
* @param array $args Positional arguments for the command. |
This file contains 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
cd ios | |
pod cache clean --all | |
rm -rf "${HOME}/Library/Caches/CocoaPods" | |
rm -rf "`pwd`/Pods/" | |
pod update |
This file contains 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 | |
/** | |
* Helper function to insert node after another node. | |
* | |
* @param DOMNode $newNode Node to be appended. | |
* @param DOMNode $refNode Node required to have new node appended after it. | |
*/ | |
function insertAfter ( $newNode, $refNode ) { | |
if( $refNode->nextSibling ){ | |
$refNode->parentNode->insertBefore( $newNode, $refNode->nextSibling ); |
This file contains 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
export const ltrim = (str, char) => { | |
let message = str; | |
if (typeof message !== 'undefined') { | |
while (message[0] === char) { | |
message = message.substring(1); | |
} | |
} | |
return message; | |
}; |
This file contains 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 Preview { | |
/** | |
* Register WordPress hooks and filters | |
* | |
* @return void | |
*/ | |
public function register() { |
This file contains 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
https://github.com/10up/wp-local-docker-v2 | |
Create new environment. | |
Edit docker-compose.yml | |
- set phpfpm image: 'liukaitj/php52' | |
- comment line | |
# - './config/php-fpm/docker-php-ext-xdebug.ini:/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini' | |
Run 10updocker stop | |
Run 10updocker start |
This file contains 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 | |
// $this->_default_secure_auth_key defined in case SECURE_AUTH_KEY is not defined. | |
/** | |
* Encrypt code using OpenSSL | |
* | |
* @param string $code The code to encrypt. | |
*/ | |
public function encrypt_code( $code ) { | |
if ( empty( $code ) ) { |
This file contains 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
Theme | |
https://marketplace.visualstudio.com/items?itemName=wesbos.theme-cobalt2 | |
GitLens | |
https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens | |
Git History | |
https://marketplace.visualstudio.com/items?itemName=donjayamanne.githistory | |
PHP Debug |
NewerOlder