This gist is an exploration of how to validate email addresses with regex as close as possible to the specification in RFC 6531.
Last updated March 28, 2021
There are now two ways to approach this:
- Using gpg and generating keys
- Using Kryptonite by krypt.co
This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions
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 | |
/** | |
* Decrypts a value. | |
* | |
* If a user-based key is set, that key is used. Otherwise the default key is used. | |
* | |
* @since 1.0.0 | |
* | |
* @param string $raw_value Value to decrypt. | |
* @param string $key Key to use for encryption. |
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 | |
/** | |
* just some file | |
*/ | |
$a = 1; | |
if ($a > 0) { | |
$a += 2; | |
print($a); |
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
#!/usr/bin/env bash | |
# Author Mike https://guides.wp-bullet.com | |
# Purpose - Convert MyISAM tables to InnoDB with WP-CLI | |
# create array of MyISAM tables | |
WPTABLES=($(wp db query "SHOW TABLE STATUS WHERE Engine = 'MyISAM'" --silent --skip-column-names | awk '{ print $1}')) | |
# loop through array and alter tables | |
for WPTABLE in ${WPTABLES[@]} | |
do |
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
function invert(tree) { | |
if (!tree instanceof Array || tree.length === 1) return tree; | |
var ret = []; | |
var inverted = tree.reverse(); | |
for(var cur in inverted) { | |
if(!inverted.hasOwnProperty(cur)) continue; | |
ret.push(inverted[cur] instanceof Array ? invert(inverted[cur]) : inverted[cur]); | |
} |
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
/* Delete revisions */ | |
DELETE FROM wp_posts WHERE post_type = "revision"; | |
/* Only use this if you no longer care about any of your current revisions! */ | |
/* Delete trashed posts */ | |
DELETE FROM wp_posts WHERE post_type = "trash"; | |
/* Delete Jetpack Feedback Spam */ | |
SELECT * FROM wp_posts WHERE wp_posts.post_type = "feedback" AND wp_posts.post_status= "spam"; |
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 | |
spl_autoload_register( function ( $class ) { | |
// project-specific namespace prefix | |
$prefix = 'my_plugin\\'; | |
// base directory for the namespace prefix | |
$base_dir = __DIR__ . '/includes/'; |
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
# Upstream to abstract backend connection(s) for php | |
upstream php { | |
server unix:/tmp/php-cgi.socket; | |
server 127.0.0.1:9000; | |
} | |
server { | |
server_name example.com; | |
root /var/www; |
NewerOlder