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 / ionos.sh
Last active February 17, 2024 17:33
1&1 ionos shared webhosting command line PHP Drush Composer Drupal
# 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 / Drupal8HorizontalTabs.php
Last active February 16, 2024 10:10
How to create horizontal tabs programmatically in Drupal 8, requires Field Group module
<?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 / iterm2-oh-my-fish.md
Last active December 31, 2023 16:37
iTerm2 Solarized Dark theme + Fish shell + oh-my-fish /// macOS High Sierra
@leymannx
leymannx / gulpfile.js
Last active July 13, 2023 15:29
Gulp Sass with autoprefixer and minify.
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 / gulpfile.js
Last active December 7, 2022 10:57
Gulp 4 Sass BrowserSync Kickstart Example
// 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 / SiteLogoBlock.php
Created October 18, 2019 07:33
Drupal 8 file upload block
<?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 / ddev.md
Last active November 3, 2021 12:26
@leymannx
leymannx / AddAnotherItem.php
Last active July 29, 2021 10:29
Drupal 8 Ajax Form Add Item Example
<?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 13:15
Drush generate field formatter
drush generate plugin-field-formatter
@leymannx
leymannx / drupal_8_menu_get_object.php
Created August 19, 2016 11:38
Drupal 8 menu get object
<?php
$node = Drupal::request()->attributes->get('node');
?>