Skip to content

Instantly share code, notes, and snippets.

View joelpittet's full-sized avatar

Joel Pittet joelpittet

View GitHub Profile
$variables['label'] = array(
'#theme' => 'form_element_label',
'#required' => isset($element['#required']) ? $element['#required'] : '',
'#title' => isset($element['#title']) ? $element['#title'] : '',
'#title_display' => isset($element['#title_display']) ? $element['#title_display'] : '',
'#id' => isset($element['#id']) ? $element['#id'] : '',
);
.DS_Store
.svn
.sass-cache
ehthumbs.db
Icon
Thumbs.db
*.log
*.orig
*.settings
*.project
@joelpittet
joelpittet / settings.php
Last active August 29, 2015 13:55
Redis config
<?php
$conf['redis_client_interface'] = 'PhpRedis';
$conf['cache_backends'][] = 'sites/all/modules/contrib/redis/redis.autoload.inc';
$conf['cache_default_class'] = 'Redis_Cache'; // DrupalAPCCache.
$conf['cache_class_cache_update'] = 'DrupalDatabaseCache';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
<?php
// Load this in a controller or preprocess or whereever.
$twig = \Drupal::service('twig');
// Create a new string loader(inline template).
$loader = new \Twig_Loader_String();
$old_loader = $twig->getLoader();
$twig->setLoader($loader);
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index c9281fa..5329be9 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -152,6 +152,13 @@ function system_help($path, $arg) {
*/
function system_theme() {
return array_merge(drupal_common_theme(), array(
+ 'branding' => array(
+ 'variables' => array(
@joelpittet
joelpittet / gist:9245960
Created February 27, 2014 07:38
git pastings
alias cap='curl `pbpaste` | git apply -v'
alias cape='curl `pbpaste` | git apply -v --index'
alias capp='curl `pbpaste` | patch -p1'
alias capv='curl `pbpaste` | patch -p1 --dry-run'
alias carp='curl `pbpaste` | git apply -Rv'
alias carpe='curl `pbpaste` | git apply -Rv --index'
alias cav='curl `pbpaste` | git apply -v --check'
@joelpittet
joelpittet / index.php
Created March 11, 2014 16:53
Twig object error
<?php
require_once 'vendor/autoload.php';
$loader = new Twig_Loader_String();
$twig_options = array(
'cache' => FALSE,
'autoescape' => TRUE,
'strict_variables' => FALSE,
// 'debug' => TRUE,
'auto_reload' => TRUE,
);
@joelpittet
joelpittet / functions.php
Created March 11, 2014 17:16
scripts and styles
<?php
/**
* Enqueue scripts and styles.
*/
function THEMENAME_scripts_styles() {
global $wp_styles;
/*
* Adds JavaScript to pages with the comment form to support
@joelpittet
joelpittet / _arrow.scss
Created March 25, 2014 21:41
Arrow Sass Mixin
/**
* $ARROW
*/
@mixin arrow($position, $size, $color, $border-size: 0, $border-color: transparent) {
// Box we're adding the arrow to.
position: relative;
background: $color;
@if $border-size != 0 {
border: $border-size solid $border-color;
}
@joelpittet
joelpittet / composer.json
Last active August 29, 2015 13:57
Example Twig Macro
{
"require": {
"twig/twig": "1.*"
}
}