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 / iterm2-oh-my-fish.md
Last active Jan 4, 2023
iTerm2 Solarized Dark theme + Fish shell + oh-my-fish /// macOS High Sierra
View iterm2-oh-my-fish.md
@leymannx
leymannx / gulpfile.js
Last active Dec 7, 2022
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 / ionos.sh
Last active Nov 9, 2022
1&1 ionos shared webhosting command line PHP Drush Composer Drupal
View ionos.sh
# https://www.ionos.com/community/hosting/php/using-php-composer-in-11-ionos-webhosting-packages/
php -v
# PHP 4.4.9 (cgi-fcgi) (built: Nov 7 2018 13:27:00)
# Copyright (c) 1997-2008 The PHP Group
# Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
/usr/bin/php7.1-cli -v
# PHP 7.1.25 (cli) (built: Dec 10 2018 10:11:36) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
@leymannx
leymannx / gulpfile.js
Last active Sep 14, 2022
Gulp Sass with autoprefixer and minify.
View gulpfile.js
var gulp = require('gulp'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
cssmin = require('gulp-cssnano'),
prefix = require('gulp-autoprefixer'),
plumber = require('gulp-plumber'),
notify = require('gulp-notify'),
sassLint = require('gulp-sass-lint'),
sourcemaps = require('gulp-sourcemaps');
// Temporary solution until gulp 4
@leymannx
leymannx / Drupal8HorizontalTabs.php
Last active Jul 16, 2022
How to create horizontal tabs programmatically in Drupal 8, requires Field Group module
View Drupal8HorizontalTabs.php
<?php
// How to create horizontal tabs programmatically in Drupal 8, requires Field Group module
$form = array();
$form['my_field'] = array(
'#type' => 'horizontal_tabs',
'#tree' => TRUE,
'#prefix' => '<div id="unique-wrapper">',
'#suffix' => '</div>',
);
$items = array(
@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;
View ddev.md
@leymannx
leymannx / AddAnotherItem.php
Last active Jul 29, 2021
Drupal 8 Ajax Form Add Item Example
View AddAnotherItem.php
<?php
/**
* @file
* Contains \Drupal\hello_world\Form\AddAnotherItem.
*/
namespace Drupal\hello_world\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
@leymannx
leymannx / drush.sh
Created May 19, 2021
Drush generate field formatter
View drush.sh
drush generate plugin-field-formatter
View drupal_8_menu_get_object.php
<?php
$node = Drupal::request()->attributes->get('node');
?>