Skip to content

Instantly share code, notes, and snippets.

View LionsAd's full-sized avatar

Fabian Franz LionsAd

  • LionsAd
  • Schweiz
View GitHub Profile
@LionsAd
LionsAd / breadcrumb.twig
Created October 7, 2012 17:42 — forked from mortendk/breadcrump.twig
twig loops
<nav class="breadcrumb" role="navigation">
<h2 class="element-invisible">{{ 'You are here'|t }}</h2>
<ol>
{% for item in breadcrumb %}
{% if loop.first %}
<li class="first">{{ item }}</li>
{% elseif loop.last %}
<li class="last">{{ item }}</li>
{% else %}
<li>{{ item }}</li>
@LionsAd
LionsAd / breadcrump.twig
Created October 7, 2012 18:07 — forked from psynaptic/breadcrump.twig
twig breadcrumbs
{% if breadcrumb is defined %}
<nav class="breadcrumb" role="navigation">
<h2 class="element-invisible">{{ 'You are here'|t }}</h2>
<ol>
{% for item in breadcrumb %}
{% if loop.last %}
<li>{{ item }}</li>
{% else %}
<li>{{ item }} » </li>
{% endif %}
@LionsAd
LionsAd / breadcrump.twig
Created October 7, 2012 18:16 — forked from mortendk/breadcrump.twig
twig breadcrumbs
{#
/**
* @file
* Returns HTML for a breadcrumb trail.
*
* @param $variables
* An associative array containing:
* - breadcrumb: An array containing the breadcrumb links.
*
* @ingroup themeable
@LionsAd
LionsAd / layout-2col.html.twig
Created October 12, 2012 01:20 — forked from EclipseGc/gist:3876811
The 2col template in twig
{#
/**
* @file
* Template for a 2 column layout.
*
* This template provides a two column display layout, with each column
* roughly equal in width.
*
* Variables:
* - attributes: Attributes to use for the layout like additional classes and id.
@LionsAd
LionsAd / node.html.twig.php
Created October 25, 2012 02:56
Twig Compiled Template
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / node.html.twig.optimized.php
Created October 25, 2012 03:27
Optimized compiled TwigTemplate
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / test-array-performance-reference.php
Created October 25, 2012 03:45
Test array performance in difference scenarios
<?php
require_once 'core/lib/Drupal/Core/Template/TwigReference.php';
use Drupal\Core\Template\TwigReference;
function getAttribute($val, $key) {
//$_GLOBALS['ref'] = &$val[$key];
return $val[$key];
}
@LionsAd
LionsAd / node.html.twig.autoescape.php
Created October 25, 2012 04:23
Auto Escaped Twig Compiled Template
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / node.html.twig.autoescape.optimized.php
Created October 25, 2012 04:28
Auto Escaped Optimized Twig Compiled Template
<?php
/* core/modules/node/templates/node.twig */
class __TwigTemplate_c2e554eca926f9ac6a6ef9a1b6d96476 extends Drupal\Core\Template\TwigTemplate
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
@LionsAd
LionsAd / xhprof-check.php
Created October 25, 2012 11:35
Diff XHProf runs against each other
<?php
$run1 = $_SERVER['argv'][1];
$run2 = $_SERVER['argv'][2];
$extra = isset($_SERVER['argv'][3])?$_SERVER['argv'][3]:'';
$source = isset($_SERVER['argv'][4])?$_SERVER['argv'][4]:'drupal-perf';
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_lib.php';
include_once '/var/www/xhprof/xhprof_lib/utils/xhprof_runs.php';
include_once '/var/www/xhprof/xhprof_lib/display/xhprof.php';