File ErrorBoundary.js
.
class ErrorBoundary extends React.Component {
state = { hasError: false };
static getDerivedStateFromError(error) {
return { hasError: true };
}
```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" |
$downloader = new \Jrdev\SatisPressDownloader('https://domain.tld/satispress/packages.json', [
// 'auth' => ['user', 'pass'], // Basic auth, if required.
// 'baseDir' => __DIR__, // Base directory to create the sub-directories `cache` and `packages`.
// 'versions' => 1, // How many versions of each package should be downloaded: 1 = the latest, 2 = the two latest versions, etc.
]);