Skip to content

Instantly share code, notes, and snippets.

View StryKaizer's full-sized avatar

Jimmy Henderickx StryKaizer

View GitHub Profile
@StryKaizer
StryKaizer / NodeIndexNid.php
Last active October 13, 2022 14:44
Exposed filters for entity references -> nodes. Port from TaxonomyIndexTid.php
<?php
namespace Drupal\yourmodule\Plugin\views\filter;
use Drupal\Core\Entity\Element\EntityAutocomplete;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\node\NodeStorageInterface;
use Drupal\views\ViewExecutable;
@StryKaizer
StryKaizer / similar.sh
Last active August 29, 2015 14:19
Find similar files in directory based on a file
#!/bin/sh
# Can be used to detect languages which lack translations in Commerce intl
# Usage:
# ./similar en.json - will compare all files in current dir with en.json
# ./similar en.json 5 - will compare all files in current dir with en.json
# and a threshold of under 5 lines being different before reporting
BASEFILE="$1"
LINE_DIFFERENCE_THRESHOLD=${2:-"40"}
@StryKaizer
StryKaizer / SA-CORE-2014-005-D7.md
Last active August 29, 2015 14:07
One liner drupal patch

OSX SA-CORE-2014-005 Quickpatch

OSX

###Includes GIT update, needs to be run in drupal folder find . -name database.inc | grep "/includes/database/database.inc" | xargs sed -i '' 's/$data /array_values($data) /';git pull; git add -A; git commit -m "Security patch SA-CORE-2014-005-D7"; git push

###Without git update, will update every drupal instance in subfolder find . -name database.inc | grep "/includes/database/database.inc" | xargs sed -i '' 's/$data /array_values($data) /'

@StryKaizer
StryKaizer / gist:10652041
Created April 14, 2014 14:15
webform fix tokens
<?php
/**
* Implements hook_template_preprocess
*
* - Webform 3 ondersteund geen tokens in submission page, dit zorgt ervoor dat we wel tokens kunnen gebruiken.
*/
function hook_preprocess_webform_confirmation(&$vars) {
$confirmation = check_markup($vars['node']->webform['confirmation'], $vars['node']->webform['confirmation_format'], '', TRUE);
module_load_include('inc', 'webform', 'includes/webform.submissions');
$submission = webform_get_submission($vars['node']->nid, $vars['sid']);
#!/bin/bash
# Daisydiff script based on https://gist.github.com/c4rl/5385704 for unix users
# Required folder structure:
# - this script
# - daisydiff folder
# - tmp folder
# CONFIGURATION
USERNAME=youruser