Skip to content

Instantly share code, notes, and snippets.

View rdrew's full-sized avatar

Rob Drew rdrew

View GitHub Profile

A collection of Drupal snippets.

Home / Front Page Tricks

Remove the Default message on home page with our creating a post

<?php if(drupal_is_front_page()) {unset($page['content']['system_main']['default_message']);} ?>
@rdrew
rdrew / drupal-8-theme-suggestions.theme
Created May 5, 2017 15:27 — forked from rikki-iki/drupal-theme-suggestions.theme
Drupal 8: various theme suggestions
use Drupal\block_content\BlockContentInterface;
/**
* Implements hook_theme_suggestions_block_alter().
*/
function HOOK_theme_suggestions_block_alter(&$hooks, &$vars) {
$block_id = $vars['elements']['#id'];
$block = \Drupal\block\Entity\Block::load($block_id);
// Region
@rdrew
rdrew / drupal-8-theme-suggestions.theme
Created May 5, 2017 15:27 — forked from rikki-iki/drupal-theme-suggestions.theme
Drupal 8: various theme suggestions
use Drupal\block_content\BlockContentInterface;
/**
* Implements hook_theme_suggestions_block_alter().
*/
function HOOK_theme_suggestions_block_alter(&$hooks, &$vars) {
$block_id = $vars['elements']['#id'];
$block = \Drupal\block\Entity\Block::load($block_id);
// Region
@rdrew
rdrew / gulpfile.js
Created January 30, 2017 17:24 — forked from esperia/gulpfile.js
Auto-generate pdf for Lilypond.
var gulp = require('gulp');
var path = require('path');
var shell = require('gulp-shell')
gulp.task('default', ['watch']);
gulp.task('watch', function(){
gulp.watch('./**/*.ly', ['build']);
});
@rdrew
rdrew / 0_reuse_code.js
Created January 5, 2017 13:30
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
@rdrew
rdrew / trello-css-guide.md
Last active August 29, 2015 14:26 — forked from bobbygrace/trello-css-guide.md
Trello CSS Guide

Trello CSS Guide

“I perfectly understand our CSS. I never have any issues with cascading rules. I never have to use !important or inline styles. Even though somebody else wrote this bit of CSS, I know exactly how it works and how to extend it. Fixes are easy! I have a hard time breaking our CSS. I know exactly where to put new CSS. We use all of our CSS and it’s pretty small overall. When I delete a template, I know the exact corresponding CSS file and I can delete it all at once. Nothing gets left behind.”

You often hear updog saying stuff like this. Who’s updog? Not much, who is up with you?

This is where any fun you might have been having ends. Now it’s time to get serious and talk about rules.

Writing CSS is hard. Even if you know all the intricacies of position and float and overflow and z-index, it’s easy to end up with spaghetti code where you need inline styles, !important rules, unused cruft, and general confusion. This guide provides some architecture for writing CSS so it stays clean and ma