Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
git reset --soft HEAD~1

Norman Kämper-Leymann leymannx

✍️
git reset --soft HEAD~1
View GitHub Profile
@leymannx
leymannx / my-drupal-scaffold.json
Last active Jan 28, 2020
Drupal Composer prevent .htaccess or development.services.yml from being overwritten using drupal/core-composer-scaffold
View my-drupal-scaffold.json
"drupal-scaffold": {
"locations": {
"web-root": "web/"
},
"file-mapping": {
"[web-root]/.htaccess": false,
"[web-root]/sites/development.services.yml": false
}
},
View ddev.md
@leymannx
leymannx / SiteLogoBlock.php
Created Oct 18, 2019
Drupal 8 file upload block
View SiteLogoBlock.php
<?php
namespace Drupal\mymodule\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\file\Entity\File;
use Drupal\file\FileUsage\FileUsageInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
@leymannx
leymannx / gulpfile.js
Last active Mar 13, 2021
Gulp 4 Sass BrowserSync Kickstart Example
View gulpfile.js
// Requires Gulp v4.
// $ npm uninstall --global gulp gulp-cli
// $ rm /usr/local/share/man/man1/gulp.1
// $ npm install --global gulp-cli
// $ npm install
const { src, dest, watch, series, parallel } = require('gulp');
const browsersync = require('browser-sync').create();
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
@leymannx
leymannx / d7-add-entity-view-mode.md
Created Oct 22, 2018 — forked from swichers/d7-add-entity-view-mode.md
Drupal 7 - Programmatically add view mode to entity
View d7-add-entity-view-mode.md

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 / DownloadSlidesFormatter.php
Last active Aug 2, 2018
Field formatter snippet for the fully working sample module on https://github.com/leymannx/mffe
View DownloadSlidesFormatter.php
<?php
namespace Drupal\mffe\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\media\Entity\Media;
use Drupal\file\Entity\File;
use Drupal\Core\Url;
@leymannx
leymannx / iterm2-oh-my-fish.md
Last active May 18, 2021
iTerm2 Solarized Dark theme + Fish shell + oh-my-fish /// macOS High Sierra
View iterm2-oh-my-fish.md
View checklist.md
View docker-compose.yml
version: '2'
services:
web:
image: php:7.0-apache
volumes:
- /var/www/myapp
bg-sync:
View docker-compose.yml
version: '2'
services:
web:
image: php:7.0-apache
volumes:
- /var/www/myapp
restart: always
bg-sync: