Skip to content

Instantly share code, notes, and snippets.

@emb03
emb03 / field--field-event-date.html.twig
Created December 27, 2019 21:11
serialize commas datetime field Drupal 8
{% for key, item in items %}
{% if loop.length == 0 %}
{% set separator = loop.last ? '' : '' %}
{% elseif loop.length == 1 %}
{% set separator = loop.last ? '' : '' %}
{% elseif loop.length == 2 %}
{% set separator = loop.last ? '' : ' and ' %}
{% elseif loop.length == 3 %}
{% set separator = loop.last ? '' : ' bot ' and loop.index == 2 ? ', and ' : ', ' %}
{% elseif loop.length == 4 %}
@emb03
emb03 / SubTerms.php
Last active December 31, 2019 18:47
Drupal 8 Services Example using PHP Traits and pass by reference
<?php
// @file src/taxterm_subs/Service/SubTerms.php
namespace Drupal\taxterm_subs\Service;
//namespace Drupal\taxterm_subs\SubtermsTraits;
//namespace Drupal\taxterm_subs\Traits;
//require_once DRUPAL_ROOT . '/modules/custom/taxterm_subs/src/SubtermsTrait/SubtermsTrait.php';
//require_once 'SubtermsTrait.php';
@emb03
emb03 / page--node--prefix--suffix-report.html.twig
Last active May 13, 2019 15:04
Drupal 8 angularjs tabbed UI with json
<!-- Fixed navbar -->
{% include directory ~ '/partials/header.html.twig' %}
{# page-banner #}
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div id="page-title-bg" style="background-image: url('{{ file_url(node.field_image.entity.fileuri) }}')"></div>
</div>
</div>
@emb03
emb03 / page--node--locations--hours.html.twig
Last active April 23, 2019 14:43
Drupal 8, angularjs, jsonp, $interval, custom filters
<!-- Fixed navbar -->
{% include directory ~ '/partials/header.html.twig' %}
<!-- page-banner -->
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div id="page-title-bg"><img src="{{ theme_base_path }}/images/page-bg.jpg" class="img-responsive " alt="bg"></div>
</div>
</div>
@emb03
emb03 / prime.module
Last active December 12, 2018 22:34
Drupal 7: A block that displays posts if the day it was created is a prime number
<?php
/**
* @file
* A block module that displays items
*/
/**
* Implements hook_block_info().
*/
@emb03
emb03 / SketchSystems.spec
Created June 3, 2018 22:37
My Awesome Sketch
My Awesome Sketch
First State
some event -> Second State
Second State
0 info it worked if it ends with ok
1 verbose cli [ '/Users/redacted/.nvm/versions/node/v7.10.1/bin/node',
1 verbose cli '/Users/redacted/.nvm/versions/node/v7.10.1/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: build
4 verbose stack at run (/Users/redacted/.nvm/versions/node/v7.10.1/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /Users/redacted/.nvm/versions/node/v7.10.1/lib/node_modules/npm/lib/run-script.js:61:5

Keybase proof

I hereby claim:

  • I am emb03 on github.
  • I am emb03 (https://keybase.io/emb03) on keybase.
  • I have a public key ASBEoprbJUDMzC0e2hCCTLfIhsNMm9K6SNDX0J_2naB6kQo

To claim this, I am signing this object: