Skip to content

Instantly share code, notes, and snippets.

View damiankloip's full-sized avatar

Damian Lee damiankloip

View GitHub Profile
{
"php_log": {
"title": "PHP log format",
"description": "Log format used by PHP (and PHP-FPM)",
"url": "http://www.php.net/",
"regex": {
"fpm": {
"pattern": "^\\[(?<date>\\d{2}-\\w{3}-\\d{4}) (?<timestamp>\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?)\\] (?<level>[A-Z]+): (?:pid (?<pid>\\d{1,8}),)?(?<body>.*)$"
},
"error": {
@damiankloip
damiankloip / git-branch-del
Created December 14, 2015 12:14
Git branch del by prefix
#! /usr/bin/env ruby
# Ruby wrapper script to filter git branches by prefix, provide a confirmation
# prompt, then delete those branches. Without confirmation prompt you can easily
# do something like `git branch -D (git branch | egrep "^\s+core-" | tr -d ' ')`
# or `(git branch | egrep "^\s+core-") | xargs git branch -D`. This could be
# done with a bash script, but Ruby is pleasant to use.
prefix = ARGV.first
git branch -D (git branch | egrep "^\s+contrib-" | tr -d ' ')
@damiankloip
damiankloip / drush.fish
Created November 23, 2015 10:13
Fish Drush completion
# Drush autocompletion
#
# Place this in your ~/.config/fish/completions/ directory, or in the
# /etc/fish/completions directory to make it available for all users.
function __complete_drush
drush --early=includes/complete.inc --verbose=0 (commandline -cpo) (commandline -t 2> /dev/null) | cut -d " " -f 1
end
complete -x -c drush -d "Drush" -a "(__complete_drush)"
@damiankloip
damiankloip / psysh-d8-casters.php
Created November 23, 2015 10:02
PsySH D8 casters
<?php
$config['casters'] = [
'Drupal\Core\Entity\ContentEntityInterface' => function($object, $array, $stub, $isNested) {
if (!$isNested) {
foreach ($object as $property => $item) {
$array[Symfony\Component\VarDumper\Caster\Caster::PREFIX_PROTECTED . $property] = $item;
}
}
<?php
$application->extend('kernel', function ($kernel, $app) {
return new YourNewHttpKernelInterfaceObject($kernel);
});
@damiankloip
damiankloip / EntityIterator.php
Created September 30, 2015 08:26
Entity iterator with generator
<?php
/**
* @file
* Contains \Drupal\Core\Entity\EntityIterator.
*/
namespace Drupal\Core\Entity;
/**
<?php
/**
* @file
* Contains \Drupal\Core\Entity\EntityIterator.
*/
namespace Drupal\Core\Entity;
/**
function fish_prompt --description 'Write out the prompt'
set -l last_status $status
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end
#USER/HOST
printf '%s@%s ' $USER (hostname -s)
diff --git a/og.module b/og.module
index 7173eeb..024cef6 100755
--- a/og.module
+++ b/og.module
@@ -86,6 +86,16 @@ define('OG_MEMBERSHIP_REQUEST_FIELD', 'og_membership_request');
*/
/**
+* Implements hook_entity_field_storage_info_alter().
+*/