Skip to content

Instantly share code, notes, and snippets.

Berdir / contententity.php
Created March 3, 2014 22:10
Drupal Content Entity Parser for Kint, place in parsers/custom
use Drupal\Core\Entity\ContentEntityInterface;
class Kint_Parsers_ContentEntity extends kintParser
private static $cache = array();
protected function _parse(&$variable)
sun / config-dev.patch
Last active August 29, 2015 13:59
D8 config in files for development
diff --git a/sites/default/settings.php b/sites/default/settings.php
index b2ce930..9d0514e 100644
--- a/sites/default/settings.php
+++ b/sites/default/settings.php
@@ -611,7 +611,8 @@
* The 'bootstrap_config_storage' setting needs to be a callable that returns
- # $settings['bootstrap_config_storage'] = array('Drupal\Core\Config\BootstrapConfigStorageFactory', 'getFileStorage');
+$settings['bootstrap_config_storage'] = 'Drupal\Core\Config\BootstrapConfigStorageFactory::getFileStorage';
use Drupal\Core\Config\Schema\SchemaCheckTrait;
* Implements hook_drush_command().
function ef_drush_command() {
$items['schema-validate'] = [
'description' => dt('Validates all config schemaj'),
jonhattan /
Created September 29, 2015 18:46
Drush command to inspect cache config of blocks, views and panels
function sb_surgery_drush_command() {
$items = array();
$items['cache-status'] = array(
'description' => 'Show cache status for each block, view, panel or minipanel',
return $items;
davereid /
Created July 24, 2012 16:40
Helpful local Drush commands
* Implements hook_drush_command().
function custom_local_drush_command() {
$items['files-fix-permissions'] = array(
'description' => 'Fix file permissions',
'options' => array(
'owner' => "The name of the user to assign ownership of all files with chown(). Defaults to \$USER.",
diff --git a/core/scripts/ b/core/scripts/
index 49b1a44..d8f471f 100755
--- a/core/scripts/
+++ b/core/scripts/
@@ -680,6 +680,7 @@ function simpletest_script_get_test_list() {
simpletest_script_print_error('No valid tests were specified.');
+ // I only want to run one test class! :)
+ $test_list = array('Drupal\book\Tests\BookTest');
juampynr /
Last active December 23, 2015 19:39
Drupalcontribute template

A DrupalConTribute is a local and remote meetup in which a group of people contribute to a Drupal module. Normally one of the module maintainers is available during the event in order to provide guidance and commit/review patches


Normally this is held over a whole day.


The local group will meet while remote people can participate through common IRC channels and Google Hangout.


jonhattan /
Last active September 17, 2016 08:48
Helper script to set up a Drupal installation. It assumes a Debian-like OS with Apache 2.4 and Drush installed. Also requires a .my.cnf file in the current user's home directory with mysql root-alike credentials. Site is installed at /var/www/${SITE}/docroot. A database, a virtualhost and an entry at /etc/hosts named ${SITE} are created. The scr…
# Check arguments and requirements.
if [ ${#@} -lt 1 ]; then
echo "This script expects one argument (site machine name)."
exit 1
if [ -x ${HOME}/.my.cnf ]; then
echo "This script requires ${HOME}/.my.cnf."
geraldvillorente / icon.txt
Last active August 17, 2017 11:40
Creating custom plugin for Ckeditor.
// Location: ckeditor_plugins/qna/icons
This is where you put the plugin icon.
jonhattan /
Last active March 9, 2018 11:03
tmux quickstart

tmux quickstart

$ tmux

CTRL+B C -> create new pane

CTRL+B [num] -> go to a pane

CTRL+D -> finish bash session, closes the pane. Closing all panes will destroy the window and thus the tmux