Skip to content

Instantly share code, notes, and snippets.

@nadavoid
nadavoid / ECK-Paragraphs-Blocks-and-Custom-Entities.md
Last active September 27, 2018 05:51
ECK, Paragraphs, Blocks, and Custom Entities in Drupal 8

ECK, Paragraphs, Blocks, and Custom Entities

ECK

  • best suited for custom relational entities
  • each ECK entity stands on its own
  • does not support translation (yet)
  • Use Inline Entity Form and Inline Entity Form Preview for best authoring experience.

Paragraphs

  • best suited for enhancing content entry on individual entities
@nadavoid
nadavoid / composer-pantheon.md
Last active November 7, 2016 20:15
Using composer to manage a single site build on Pantheon

This doc has been moved to my blog: https://www.davidlanier.com/blog/2016/11/using-composer-on-pantheon

I worked through https://pantheon.io/blog/using-composer-relocated-document-root-pantheon and chased a few rabbits, and ultimately landed on what I think a pretty simple workflow. The main thing I was interested in was how to use composer to effectively manage a drupal project on pantheon. Composer is practically required for building the codebase of Drupal 8 because there are so many external dependencies now. Composer handles downloading the right versions of all packages.

The main steps:

  • Create a new site at pantheon, selecting "Drops 8 Composer"
@nadavoid
nadavoid / radios.css
Created May 19, 2015 22:10
Radios as buttons
/* Radio Buttons */
input[type="radio"] {
display: none;
}
input[type="radio"] + label {
display: inline-block;
padding: 20px 30px;
background-color: teal;
color: white;
border-radius: 4px;
<?php
// Example of programmatically executing a patch process.
// @see https://api.drupal.org/api/drupal/includes!form.inc/function/batch_process/7
// @see https://www.drupal.org/node/873132
// @see pathauto_bulk_update_form_submit()
$callback = 'user_pathauto_bulk_update_batch_process';
$batch = array(
'title' => t('Bulk updating URL aliases'),
'operations' => array(
array('pathauto_bulk_update_batch_start', array()),
@nadavoid
nadavoid / 0_reuse_code.js
Created May 16, 2014 17:16
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
<?php require_once trim(`which phpunit`);
@nadavoid
nadavoid / exec_with_timer.sh
Created December 22, 2011 23:30
Execute an arbitrary command and track how much time it takes, in seconds.
if [ "$1" ]; then
START=$(date +"%s")
echo "Doing: $1"
$1
END=$(date +"%s")
ELAPSED=`expr $END - $START`
echo "Operation took $ELAPSED seconds."
else
echo "Usage:
exec_with_timer.sh 'command to run'
@nadavoid
nadavoid / extdata:sample.yaml
Created December 19, 2011 18:07
Puppet Conditional in Template
---
parameters:
server_tags: "role:all=true,role:dev=true"
@nadavoid
nadavoid / xdebug.ini
Created September 23, 2011 14:32
xdebug config file
;;;;;;;;;;
; XDebug ;
;;;;;;;;;;
zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
;xdebug.remote_host=localhost