'Cause it's nearly impossible to var_dump
or dump
into an Ajax Dialog or an Ajax Command, the most easier way is to write into the Apache logs.
To do this, just add the following snippet in your code:
error_log(var_export($var), TRUE);
#!/bin/bash | |
team=("Stephanie" "Dan" "Tish" "Alex" "Blazej" "John" "Mattia" "Christophe" "Maria" "Matt" "Gesche" "Lisa" "Dominic" "Nick" "Jamie" "Thomas" "Vasi" "Inky" "Chris" "Philipp" "Marco" "Beat") | |
suspense=("Picking" "🤔Changing" "😛Cheating") | |
RANDOM=$$$(date +%s) | |
# Get the winner | |
winner=${team[$RANDOM % ${#team[@]} ]} | |
# Produce some suspense |
<?php | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function MODULE_form_user_login_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { | |
// Allow login with email. | |
array_unshift($form['#validate'], 'MODULE_user_login_form_validate'); | |
// Change the field label. | |
$form['name']['#title'] = new \Drupal\Core\StringTranslation\TranslatableMarkup('Email or Username'); |
<?php | |
/* Demonstration of problem with large integers in JSON, and | |
a couple options for dealing with them as strings instead. | |
ref: | |
* http://php.net/manual/en/function.json-decode.php | |
* http://stackoverflow.com/questions/2907806/handling-big-user-ids-returned-by-fql-in-php | |
*/ | |
$json = <<<EOT |
#!/bin/sh | |
# size of swapfile in megabytes | |
swapsize=8000 | |
# does the swap file already exist? | |
grep -q "swapfile" /etc/fstab | |
# if not then create it | |
if [ $? -ne 0 ]; then |
List of PHP 7 Packages: https://launchpad.net/ubuntu/+source/php7.0 | |
Disclaimer: I get unreliable results when I don't run these commands seperately and in order. | |
vagrant ssh | |
sudo apt-get update | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get install php7.0 | |
sudo apt-get update |
const jwt = require('jsonwebtoken'); | |
const authMiddleware = (req, res, next) => { | |
const authHeader = req.get('Authorization') | |
if (!authHeader) { | |
req.error = "No authentication header found." | |
req.isAuth = false | |
return next() | |
} |
<?php | |
namespace Drupal\my_module\Services; | |
use Drupal\Core\Logger\LoggerChannelFactory; | |
/** | |
* Class MyService. | |
* | |
* @package Drupal\my_module\Services |