This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Delete all nodes. | |
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute()); | |
// Delete all files. | |
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute()); | |
// Delete all taxonomy terms. | |
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dscl . -read /Users/$user UserShell | sed s/^UserShell:\ // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example using cookie auth. | |
print (string) \Drupal::httpClient() | |
->get('http://example.com/node/1', [ | |
'headers' => ['Accept' => 'application/json'], | |
'cookies' => ['SESS07e0668737e9f97189850d2cf0c79892' => 'dasGegKQ6ZzEF0xvRZWWzwrl9tt7UT8fGuXrAeLC9P1'], | |
]) | |
->getBody(TRUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The easy version is `curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0` | |
# It might be better to use (build-entropy-php)[https://github.com/liip/build-entropy-php] for building. | |
# Create the destinaiton folder. | |
mkdir -p /usr/local/builds/php | |
# Clone the php source (Just using the master branch). | |
git clone https://git.php.net/repository/php-src.git /usr/local/builds/php/7.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop all tables in a db. | |
function mysql-drop-tables { | |
if [[ $1 != "" ]]; then | |
if [[ $(get_yes "$@") != "1" ]]; then | |
echo "You are about to drop all files in the $1 database. Are you sure? (Y or N):" | |
read RESPONSE | |
fi | |
if [[ $(get_yes "$@") == "1" || $RESPONSE == "y" || $RESPONSE == "Y" ]]; then | |
mysqldump -uroot --add-drop-table --no-data $1 | grep ^DROP | mysql -uroot $1 | |
echo "$1 has been emptied!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery('.toolbar-toggle-orientation button').click(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** @var \Drupal\Core\Entity\EntityManager $entity_manager */ | |
$entity_manager = \Drupal::service('entity.manager'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\Core\Field\BaseFieldDefinition; | |
use Drupal\Core\Field\EntityReferenceFieldItemList; | |
use Drupal\Core\TypedData\DataDefinition; | |
use Drupal\Core\TypedData\Plugin\DataType\ItemList; | |
/** | |
* Provides a 'FooBlock' block. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
\Drupal::service('config.manager')->createSnapshot(\Drupal::service('config.storage'), \Drupal::service('config.storage.snapshot')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Some possible additions to the settings.php file or the settings.local.php file. | |
*/ | |
$databases = ['default' => ['default' => [ | |
'database' => 'db', | |
'username' => 'user', | |
'password' => 'pwd', |