Skip to content

Instantly share code, notes, and snippets.

View leymannx's full-sized avatar
✍️
git reset --soft HEAD~1

Norman Kämper-Leymann leymannx

✍️
git reset --soft HEAD~1
View GitHub Profile
@leymannx
leymannx / d7-add-entity-view-mode.md
Created October 22, 2018 08:16 — forked from swichers/d7-add-entity-view-mode.md
Drupal 7 - Programmatically add view mode to entity

In a module file:

This will enable an additional view mode for use on the specified entity type(s). Many examples will show the custom settings here being set to TRUE. If TRUE is used then that view mode is added to all entities of the specified type regardless of if it should be on the bundle or not.

/**
 * Implements hook_entity_info_alter().
 */
function HOOK_entity_info_alter(&$entity_info) {
@leymannx
leymannx / Dockerfile
Last active August 8, 2018 00:59 — forked from Majkl578/Dockerfile
[Updated PHP7.0 to PHP 7.1 ] Dockerized example for article at Pehapkari.cz about running multiple PHP versions on NGINX: https://pehapkari.cz/blog/2017/03/27/multiple-php-versions-the-easy-way/
FROM debian:stretch
ENV DEBIAN_FRONTEND noninteractive
# install NGINX
RUN apt-get update && \
apt-get install -y nginx --no-install-recommends && \
rm -rf /var/lib/apt/lists/*
@leymannx
leymannx / webhook.php
Last active November 6, 2018 14:43 — forked from cowboy/github_post_recieve.php
PHP webhook to pull and Gulp build automatically after push
<?php
if ( isset($_POST['payload']) && $_POST['payload'] ) {
echo shell_exec('cd /var/www/mydrupal/ && sudo -u myuser git pull');
echo shell_exec('cd /var/www/mydrupal/sites/all/themes/mytheme/ && sudo -u myuser node ./node_modules/gulp/bin/gulp.js mygulptask');
// Adding the drush will cause the delivery being displayed as unsuccessful. Means GitHub doesn't wait so long. The command will run nevertheless.
echo shell_exec('cd /var/www/mydrupal/ && sudo -u myuser drush @sites cc all -y');
}
// Should return www-data
@leymannx
leymannx / SCSS.md
Created October 24, 2016 09:53 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso