- Install Dependencies
sudo apt update
sudo apt install ffmpeg
ffpmeg -v
<?php | |
//required include files | |
require('wp-blog-header.php'); | |
require_once("wp-config.php"); | |
require_once("wp-includes/wp-db.php"); | |
include_once WP_PLUGIN_DIR . '/redirection/models/group.php'; | |
if(!isset($_GET['run'])) return; |
let url = '/user' | |
Drupal.ajax({ | |
url, | |
dialog: { | |
'width': 'auto', | |
'maxWidth': 500 | |
}, | |
dialogType: 'modal' | |
}).execute() |
echo 'Rebuilding Cache' | |
./vendor/drush/drush/drush cr | |
echo 'Updating DB' | |
./vendor/drush/drush/drush updb -y | |
echo 'Importing Config' | |
./vendor/drush/drush/drush cim -y | |
echo 'Updating Entities' | |
./vendor/drush/drush/drush entup -y |
<?php | |
// @codingStandardsIgnoreFile | |
/** | |
* @file | |
* Local development override configuration feature. | |
* | |
* To activate this feature, copy and rename it such that its path plus | |
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of |
<?php | |
use Drupal\Core\Form\FormBase; | |
use Drupal\Core\Form\FormStateInterface; | |
class CustomUserForm extends FormBase { | |
public function buildForm(array $form, FormStateInterface $form_state) { | |
$form['#parents'] = []; | |
$entity = \Drupal::service('entity_type.manager')->getStorage('user')->create(); |
<?php | |
# https://stackoverflow.com/questions/17750143/catching-stripe-errors-with-try-catch-php-method | |
try { | |
// Use a Stripe PHP library method that may throw an exception.... | |
\Stripe\Customer::create($args); | |
} catch (\Stripe\Error\Base $e) { | |
// Code to do something with the $e exception object when an error occurs | |
echo($e->getMessage()); | |
} catch (Exception $e) { | |
// Catch any other non-Stripe exceptions |
<?php | |
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias'); | |
if(preg_match('/node\/(\d+)/', $path, $matches)) { | |
$node = \Drupal\node\Entity\Node::load($matches[1]); | |
} |
// https://levelup.gitconnected.com/the-definite-guide-to-handling-errors-gracefully-in-javascript-58424d9c60e6 | |
class CustomError extends Error { | |
constructor(code = 'GENERIC', status = 500, ...params) { | |
super(...params) | |
if (Error.captureStackTrace) { | |
Error.captureStackTrace(this, CustomError) | |
} |
# Redis | |
docker run --name some-redis -p6379:6379 -d redis redis-server --appendonly yes |