Skip to content

Instantly share code, notes, and snippets.

View tombola's full-sized avatar

Tom Readings tombola

  • Freelance
  • Devon
View GitHub Profile
@tombola
tombola / compare_branches
Last active March 23, 2017 10:35
List view modes used in current branches (from config filenames, rather than db).
#!/usr/bin/env bash
list_node_viewmodes() {
read BRANCH
REPLACE='config/sync/core.entity_view_mode.node.'
if [[ $BRANCH ]]; then
echo '========='$BRANCH
echo ''
git ls-tree -r --name-only $BRANCH | grep "config\/sync\/core\.entity_view_mode\.node" | \
while read VIEWMODES
@tombola
tombola / example.module.php
Last active March 17, 2017 13:29 — forked from zerolab/example.module.php
Drupal 8 pass data down ER fields
<?php
/**
* @file
* An example of how to pass the item number from a multi-value
* entityreference field to the entities concerned.
*/
/**
* Implements hook_preprocess_field().
@tombola
tombola / 0_reuse_code.js
Created January 13, 2017 15:34
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console