File ErrorBoundary.js.
class ErrorBoundary extends React.Component {
state = { hasError: false };
static getDerivedStateFromError(error) {
return { hasError: true };
}| <?php | |
| /** | |
| * array_merge_recursive does indeed merge arrays, but it converts values with duplicate | |
| * keys to arrays rather than overwriting the value in the first array with the duplicate | |
| * value in the second array, as array_merge does. I.e., with array_merge_recursive, | |
| * this happens (documented behavior): | |
| * | |
| * array_merge_recursive(array('key' => 'org value'), array('key' => 'new value')); | |
| * => array('key' => array('org value', 'new value')); |
| <?php | |
| /* | |
| Plugin Name: Hide WP Admin Bar | |
| Plugin URI: https://gist.github.com/jrobinsonc/fd229cef8df0e38205c0b96f2e455d16 | |
| Description: Hides the WordPress admin bar by clicking on the logo of the admin bar. | |
| Author: Jose Robinsosn | |
| Version: 1.0 | |
| Author URI: https://joserobinson.com | |
| */ |
| <?php | |
| function get_current_url() { | |
| global $wp; | |
| return home_url( $wp->request ); | |
| } |
| ```shell | |
| grep DB_NAME wp-config.php | awk -F "'" '{print $4}' | |
| grep DB_USER wp-config.php | awk -F "'" '{print $4}' | |
| grep DB_PASSWORD wp-config.php | awk -F "'" '{print $4}' | |
| ``` |
| DROP FUNCTION `quit_accents`; | |
| CREATE FUNCTION `quit_accents`(str longtext) | |
| RETURNS longtext CHARSET utf8 | |
| BEGIN | |
| DECLARE result LONGTEXT; | |
| SET result = str; | |
| SET result = REPLACE(result, 'á', 'a'); | |
| SET result = REPLACE(result, 'é', 'e'); |
| const fetch = options => | |
| new Promise((resolve, reject) => { | |
| require('https').get(options, function(response) { | |
| let body = ''; | |
| if (response.statusCode !== 200) { | |
| reject( | |
| new Error(`Request failed. Status code: ${response.statusCode}`), | |
| ); |
| #!/usr/bin/env sh | |
| set -e | |
| [ -d wp-admin ] || wp core download | |
| [ -f wp-config.php ] || wp config create \ | |
| --dbhost="$WP_DB_HOST" \ | |
| --dbname="$WP_DB_NAME" \ | |
| --dbuser="$WP_DB_USER" \ |
File ErrorBoundary.js.
class ErrorBoundary extends React.Component {
state = { hasError: false };
static getDerivedStateFromError(error) {
return { hasError: true };
}| #!/bin/bash | |
| # bash generate random alphanumeric string | |
| # | |
| # bash generate random 32 character alphanumeric string (upper and lowercase) and | |
| NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
| # bash generate random 32 character alphanumeric string (lowercase only) | |
| cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |