Skip to content

Instantly share code, notes, and snippets.

View derhasi's full-sized avatar
💚
Life is green!

Johannes Haseitl derhasi

💚
Life is green!
  • Nuremberg, Germany
  • 16:16 (UTC +02:00)
View GitHub Profile
@derhasi
derhasi / git-cleanup.sh
Last active April 23, 2021 08:46
Cleans up git repo by rebasing current branches (if possible) and deleting already merged branches
#!/bin/bash
# Cleans up git repo by rebasing local branches (if possible) and deleting already merged branches
set -e
git fetch --all
BASE_BRANCH="origin/master"
CHECKOUT_BRANCH="master"
@derhasi
derhasi / build.sh
Last active October 14, 2019 13:43
#!/usr/bin/env bash
set -e
# Create build commit by pulling the remote branch and copying over the files from the project build
# which contain data in the docroot we usually do not commit.
LAST_COMMIT_INFO=$(git log -1 --pretty="[%h] (%an) %B")
LAST_COMMIT_USER=$(git show -s --format="%an")
LAST_COMMIT_USER_EMAIL=$(git show -s --format="%ae")
CURRENT_REV=$(git rev-parse --abbrev-ref HEAD)
# We store directory values, so we can restore them later.
@derhasi
derhasi / drupal_8_entity_delete.php
Last active January 31, 2017 18:42
Delete all entities of a entity type $entity_type
$controller = \Drupal::entityManager()->getStorage($entity_type);
$entities = $controller->loadMultiple(NULL);
dvm(array_keys($entities));
$controller->delete($entities);
<?php
$ini = file_get_contents(__DIR__ . '/../make.ini');
/**
* @var SplFileInfo $path
* @var SplFileInfo $file
*/
<?php
$ini = file_get_contents(__DIR__ . '/../make.ini');
/**
* @var SplFileInfo $path
* @var SplFileInfo $file
*/
foreach(new DirectoryIterator(__DIR__ . '/sites/all/modules/contrib') as $path) {
@derhasi
derhasi / add-project-info.php
Created June 8, 2016 08:25
Add Drupal Project key to every .info file
<?php
/**
* @var SplFileInfo $path
* @var SplFileInfo $file
*/
foreach(new DirectoryIterator(__DIR__ . '/sites/all/modules/contrib') as $path) {
$projectname = $path->getFilename();
git checkout build
find . -not -name ".git" -not -name "." -not -name ".." -maxdepth 1 | xargs rm -rf
git checkout develop -- .
composer install
find . -type d -name ".git" -not -path "./.git" | xargs rm -rf
@derhasi
derhasi / check_error_notification.js
Created April 29, 2016 12:55
Small helper script (e.g. for Chrome Snippets) to throw a Browser Notification when a .error occurs
Notification.requestPermission().then(function(result) {
function checkError() {
console.log('check error');
if (jQuery('.error').length > 0) {
new Notification("Batch error occured");
}
else {
setTimeout(checkError, 10000);
}
}
# Ignore freistilbox related files
/config
/private
/tmp
# Ignore configuration files that may contain sensitive information or are
# dependent on the environment
/docroot/sites/default/settings.php
/docroot/sites/default/local.settings.php
/docroot/sites/default/settings.local.php