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
View keybase.md

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 Aug 29, 2015
Drupal comment approval messages with Akamai
View page.tpl.php
<?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">
@leymannx
leymannx / template.php
Created Nov 16, 2015
Drupal replace trimmed username by full username
View template.php
/**
* Implements THEME_preprocess_username().
*/
function THEME_preprocess_username(&$vars) {
$vars['name'] = $vars['name_raw'];
}
@leymannx
leymannx / hook_module_implements_alter.module
Created Jan 25, 2016
Lets your custom Drupal module run first or last. Uncomment the unneeded.
View hook_module_implements_alter.module
/**
* 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 / user_has_role.module
Created Feb 16, 2016
Drupal hook menu user role access argument
View user_has_role.module
/**
* 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 Feb 17, 2016
Drupal 7 Snippet to create taxonomy term by name, if it doesn't exist yet and return the term object anyways.
View create_term.module
/**
* 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 Jun 19, 2016
unordered list <ul> with colored bullets and finer indent
View ul_colored_bullets_with_indent.scss
ul {
list-style: none;
padding: 0;
li {
margin-left: 12px;
text-indent: -13px;
}
li:before {
content: "\2022\00a0\00a0";
color: purple;
View .bash_profile
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'
View drush-drupal-8-aggregation-off.sh
# disable CSS/JS aggregation
drush -y config-set system.performance css.preprocess 0 && drush -y config-set system.performance js.preprocess 0
@leymannx
leymannx / fonts.css
Last active Oct 11, 2016
Ultimate text rendering
View fonts.css
// https://google.github.io/material-design-icons/
body {
/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;