File ErrorBoundary.js
.
class ErrorBoundary extends React.Component {
state = { hasError: false };
static getDerivedStateFromError(error) {
return { hasError: true };
}
<?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 |
# This is a general-purpose function to ask Yes/No questions in Bash, either | |
# with or without a default answer. It keeps repeating the question until it | |
# gets a valid answer. | |
ask() { | |
# https://gist.github.com/davejamesmiller/1965569 | |
local prompt default reply | |
if [ "${2:-}" = "Y" ]; then | |
prompt="Y/n" |