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
// Install Extension https://marketplace.visualstudio.com/items?itemName=felixfbecker.php-debug | |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Listen for XDebug", | |
"type": "php", | |
"request": "launch", | |
"port": 9000, | |
"pathMappings": { |
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
/** | |
* URL normalization, make sure HTML entities are escaped. | |
* | |
* @param String url | |
* | |
* @return String | |
*/ | |
export function normalizeURL(url) { | |
const fixedEncodeURIComponent = str => encodeURIComponent(str).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16)}`); |
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
const toUnicode = (str) => { | |
let unicodeString = ''; | |
for (var i = 0; i < str.length; i ++) { | |
let unicodeStr = str.charCodeAt(i).toString(16).toUpperCase(); | |
while (unicodeStr.length < 4) { | |
unicodeStr = `0${unicodeStr}`; | |
} |
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
watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache |
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 /Users/lucy/Library/Android/sdk | |
tools/emulator -avd Nexus_5X_API_23 -writable-system& | |
prepare file /tmp/hosts with contents: | |
127.0.0.1 localhost | |
::1 ip6-localhost | |
192.168.50.4 politico.test | |
Then execute: |
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
// Run in the Terminal | |
----------------------------------------------- | |
$ openssl genrsa -out mysite.dev.key 2048 | |
$ openssl req -new -key mysite.dev.key -out mysite.dev.csr | |
----------------------------------------------- | |
Answer questions after this last command | |
Then: | |
Create a mysite.dev.ext | |
And copy the following. |
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
git branch -m old_branch new_branch | |
git push --set-upstream origin new_branch | |
git push origin :old_branch |
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
Using vvv2 with vv create from https://github.com/bradp/vv has incomaptibility | |
Workarund: | |
First add site to vvv-custom.yml | |
testvv: | |
skip_provisioning: false | |
hosts: | |
- testvv.dev |
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 | |
/** | |
* Encrypt password using OpenSSL | |
* | |
* @param string $password The password to encrypt. | |
*/ | |
public function encrypt_password( $password ) { | |
$encryption_key = base64_decode( SECURE_AUTH_KEY ); | |
$iv = openssl_random_pseudo_bytes( openssl_cipher_iv_length( 'aes-256-cbc' ) ); | |
$encrypted = openssl_encrypt( $password, 'aes-256-cbc', $encryption_key, OPENSSL_RAW_DATA, $iv ); |
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 | |
/** | |
* Return true if current screen is edit screen of a post type or list of post types. | |
* | |
* @param string|array $post_type Single or list of post types. | |
* @return boolean | |
*/ | |
function is_edit_screen( $post_types = array() ) { | |
global $pagenow; | |
if ( 'post.php' !== $pagenow ) { |