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

Keybase proof

I hereby claim:

  • I am leymannx on github.
  • I am leymannx (https://keybase.io/leymannx) on keybase.
  • I have a public key whose fingerprint is 1F89 E9C5 B8C7 4C5E BE27 1823 FB98 ABFE B426 6C86

To claim this, I am signing this object:

@leymannx
leymannx / page.tpl.php
Last active August 29, 2015 14:22
Drupal comment approval messages with Akamai
<?php
// When Drupal is cached by Akamai it happens sometimes that $messages ain't displayed when the page is done.
// Instead the $message get rendered only after the user visits another page, on that another page.
// So I disabled Drupal messages for anonymous users completely (theme_status_messages)
// and built the following workaround for comment approval messages.
<script id="message-queued" type="text/template">
// Inside an inline script I parked the markup plus text that normally is displayed.
// By setting type=text/template it is ignored by browsers but will be available for later display.
<div id="messages">
<div class="section clearfix">
export PATH="/usr/local/sbin:$PATH"
alias ob='open ~/.bash_profile'
alias sb='source ~/.bash_profile'
alias oc='open ~/.ssh/config'
alias ll='ls -lhA'
alias ls='ls -la'
alias keygen='ssh-keygen -t rsa -b 4096'
alias hg='history | grep'
@leymannx
leymannx / template.php
Created November 16, 2015 10:02
Drupal replace trimmed username by full username
/**
* Implements THEME_preprocess_username().
*/
function THEME_preprocess_username(&$vars) {
$vars['name'] = $vars['name_raw'];
}
@leymannx
leymannx / hook_module_implements_alter.module
Created January 25, 2016 12:17
Lets your custom Drupal module run first or last. Uncomment the unneeded.
/**
* Implements hook_module_implements_alter().
*/
function MYMODULE_module_implements_alter(&$implementations, $hook) {
// run last
if ($hook == 'MYHOOK') {
$module = 'MYMODULE';
$group = $implementations[$module];
unset($implementations[$module]);
@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 / user_has_role.module
Created February 16, 2016 15:54
Drupal hook menu user role access argument
/**
* Implements hook_menu().
*/
function user_has_role_menu() {
$items['admin/mypage'] = array(
'page callback' => 'user_has_role_page_content',
'access callback' => '_user_has_role',
'access arguments' => array(array('editor')),
);
return $items;
@leymannx
leymannx / create_term.module
Created February 17, 2016 09:17
Drupal 7 Snippet to create taxonomy term by name, if it doesn't exist yet and return the term object anyways.
/**
* Helper function to create a term by name, if it doesn't exist yet.
*
* @param $term_name string
* Human readable term name.
* @param $vocabulary_name string
* Vocabulary machine name.
* @param $weight integer.
* Term weight.
*
@leymannx
leymannx / ul_colored_bullets_with_indent.scss
Created June 19, 2016 20:16
unordered list <ul> with colored bullets and finer indent
ul {
list-style: none;
padding: 0;
li {
margin-left: 12px;
text-indent: -13px;
}
li:before {
content: "\2022\00a0\00a0";
color: purple;
@leymannx
leymannx / simple_gulpfile.js
Last active January 26, 2017 08:54
Gulp Sass Watch LiveReload (needs simple LiveReload Chrome extension)
// Require gulp and plugins
var gulp = require('gulp'),
sass = require('gulp-sass'),
gutil = require('gulp-util');
// Define file sources
var sassMain = ['scss/styles.scss'];
var sassSources = ['scss/**/*.scss']; // Any .scss file in any sub-directory