Skip to content

Instantly share code, notes, and snippets.

View pfaocle's full-sized avatar

Paul Byrne pfaocle

View GitHub Profile
@pfaocle
pfaocle / remove_null_filters.php
Created January 27, 2016 16:59
Remove null filters from migrated D8 text formats
<?php
use Drupal\filter\Plugin\Filter\FilterNull;
/**
* Run on migrated text formats which have "missing" or null filters.
*
* @see \Drupal\filter\FilterFormatFormBase::form()
*/
function _update_text_formats() {
@pfaocle
pfaocle / mysql_drop_tables.sh
Created February 11, 2016 12:29
Drop all tables in DB via command line
#!/usr/bin
mysqldump -u username -p --no-data dbname | grep ^DROP > drop.sql
mysql -u username -p dbname < drop.sql
rm drop.sql
@pfaocle
pfaocle / ContentTypes.php
Created March 11, 2016 09:50
Generic Codeception Cest for testing content types and fields with Drupal Content Type Registry
<?php
use \AcceptanceTester\AuthenticatedSteps;
use \Codeception\Module\Drupal\ContentTypeRegistry\ContentType;
use \Codeception\Module\Drupal\Pages\AdminContentTypesPage;
use \Codeception\Module\Drupal\Pages\AdminManageFieldsPage;
/**
* Test defined content types and fields.
*
* @guy AcceptanceTester\AuthenticatedSteps
@pfaocle
pfaocle / NodeParagraphTextarea.php
Created October 19, 2016 08:57
Migrate D6 node body into D8 Paragraphs field
<?php
/**
* @file
* Migrate D6 node body into D8 Paragraphs field.
*
* @see http://www.amitgoyal.in/2016/03/d6-d8-migration-d6-body-d8-paragraph-type-text.html
*/
namespace Drupal\ixis_migrate_from_d6\Plugin\migrate\process;
@pfaocle
pfaocle / git-prune-local-branches-with-deleted-remote.sh
Created April 5, 2016 09:26
Prune local tracking branches that do not exist on remote anymore
git fetch --prune && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@pfaocle
pfaocle / gen-d8-salt.sh
Created March 8, 2016 09:39
Generate Drupal 8 hash salt
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))"