Skip to content

Instantly share code, notes, and snippets.

View danny-englander's full-sized avatar

Danny Englander (he/him) danny-englander

View GitHub Profile
@lewisnyman
lewisnyman / field.html.twig
Last active December 21, 2016 14:49
minimal field.html.twig — Drupal 8
{% for item in items %}
{{ item.content }}
{% endfor %}
@jacurtis
jacurtis / _spacing-helpers.scss
Last active April 15, 2024 12:05
SASS Margin and Padding Helpers Loop. Generates .m-t-10 type helper classes.
/*
This .scss loop will create "margin helpers" and "padding helpers" for use in your web projects.
It will generate several classes such as:
.m-r-10 which gives margin-right 10 pixels.
.m-r-15 gives MARGIN to the RIGHT 15 pixels.
.m-t-15 gives MARGIN to the TOP 15 pixels and so on.
.p-b-5 gives PADDING to the BOTTOM of 5 pixels
.p-l-40 gives PADDING to the LEFT of 40 pixels
@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"
@jacine
jacine / icon.html.twig
Last active November 2, 2016 16:26
Icons for Menu Item links broke with 8.2 upgrade!
{#
/**
* @file
* Drupal pass-through template for icon theme hook implementation.
*
* @see /themes/THEME/components/icon.twig.
*/
#}
{% embed '@components/icon.twig' %}{% endembed %}
@waako
waako / themename.theme.php
Last active October 6, 2016 10:59
Drupal 8 Block and Menu template suggestions
<?php
/**
* Implements hook_theme_suggestions_HOOK_alter().
*/
function THEMENAME_theme_suggestions_block_alter(array &$suggestions, array $variables) {
$block_id = $variables['elements']['#id'];
// See if block ID contains the word mobile.
$is_mobile_block = strpos($block_id, 'mobile');
$block = \Drupal\block\Entity\Block::load($block_id);
@thejimbirch
thejimbirch / paragraph--default.html.twig
Last active March 22, 2021 18:29
Drupal 8 Template for Bootstrap Paragraphs customized for Width and Background color fields.
{#
/**
* @file
* Default theme implementation to display a paragraph in Bootstrap Paragraphs.
*
* Available variables:
* - paragraph: Full paragraph entity.
* - id: The paragraph ID.
* - bundle: The type of the paragraph, for example, "image" or "text".
* - authorid: The user ID of the paragraph author.
@jacine
jacine / composer.md
Last active August 31, 2016 19:13
Composer

Composer Workflow

Composer is a package manager similar to NPM for JavaScript, but for dealing with PHP packages. We use it to manage Drupal core, contributed modules (and other 3rd party libraries needed) and patches. The following section is a quick reference for common tasks. Ensure you have installed/updated Composer before proceeding.

*Note about Git: While this will be obvious to most, it bears mentioning that after you're finished installing, updating or patching with Composer, you'll need to add the changes/additions to version control.

Contributed Modules

Note: When a specific version isn't specified, composer prefers stable over RC over beta over alpha over DEV releases.

@danny-englander
danny-englander / zsh-backup.sh
Last active September 1, 2016 14:52
An automated drush backup script with folder pruning using ZSH Globbing
#! /bin/zsh
## An automated Drupal backup script using Drush and ZSH globbing.
## Ideally place this script in usr/local/bin
## Set this to run via a cronjob.
## Easy crontab setup: http://crontab-generator.org
## Inspiration from: by https://www.drupal.org/node/470114
@jacine
jacine / setup.md
Last active September 24, 2016 15:14
Drupal 8 setup

Drupal 8 Setup

  1. Copy sites/default/default.settings.php, renaming to sites/default/settings.local.php.
  2. Copy sites/default/development.services.yml, renaming to sites/default/services.yml.

Changes in settings.local.php:

@todo Write out details. https://gist.github.com/jacine/4520c74beb5b77ef5af8

var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
spritesmith = require('gulp.spritesmith'),
compass = require('gulp-compass'),
path = require('path'),
minifyCss = require('gulp-minify-css'),
browserSync = require('browser-sync'),
tinypng = require('gulp-tinypng'),
autoprefixer = require('gulp-autoprefixer'),
plumber = require('gulp-plumber');