Skip to content

Instantly share code, notes, and snippets.

chx

Block or report user

Report or block chx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View slcs.info.yml
name: 'Scale Language Content Settings'
type: module
description: 'Scale Language Content Settings form'
core: 8.x
View x.php
<?php
interface foo {
}
interface bar {
function foo(Foo $foo);
}
class broken implements bar {
function foo(bar $x) {}
}
View gist:50db023a4c300f99850b3fe78a135811
REPLACE(REPLACE(REPLACE(
TO_BASE64(UNHEX(SHA2(CONCAT(:string1, LENGTH(language), :string2, language, :string3, LENGTH(redirect_source__path), :string4, redirect_source__path, :string5), 256))),
'+', '-'), '/', '_'), '=', '') AS hash_calc,
':string1' => 'a:2:{s:8:"language";s:',
':string2' => ':"',
':string3' => '";s:6:"source";s:',
':string4' => ':"',
':string5' => '";}',
@chx
chx / gist:eb71941faae245bbf7d0f20747551c21
Last active Dec 22, 2018
https://www.drupal.org/node/2342699 sets $pid to 1 on update, corrupting data in hook_path_update
View gist:eb71941faae245bbf7d0f20747551c21
diff --git a/core/lib/Drupal/Core/Path/AliasStorage.php b/core/lib/Drupal/Core/Path/AliasStorage.php
index b68984871..34a8ca381 100644
--- a/core/lib/Drupal/Core/Path/AliasStorage.php
+++ b/core/lib/Drupal/Core/Path/AliasStorage.php
@@ -106,10 +106,10 @@ public function save($source, $alias, $langcode = LanguageInterface::LANGCODE_NO
$this->catchException($e);
$original = FALSE;
}
- $query = $this->connection->update(static::TABLE)
+ $this->connection->update(static::TABLE)
View 3018942.patch
diff --git a/docroot/core/modules/block/src/BlockListBuilder.php b/docroot/core/modules/block/src/BlockListBuilder.php
index d2286fcdd..d54c212a2 100644
--- a/docroot/core/modules/block/src/BlockListBuilder.php
+++ b/docroot/core/modules/block/src/BlockListBuilder.php
@@ -4,6 +4,7 @@
use Drupal\Component\Utility\Html;
use Drupal\Component\Serialization\Json;
+use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
@chx
chx / Table.php
Created Dec 6, 2018
Plain table migration source plugin
View Table.php
<?php
namespace Drupal\sd8_migration\Plugin\migrate\source;
use Drupal\migrate\Plugin\migrate\source\SqlBase;
/**
* Table source from database.
*
@chx
chx / EntityArrayHelper.php
Created Dec 6, 2018
Helper for migrations with paragraphs
View EntityArrayHelper.php
<?php
namespace Drupal\sd8;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Field\EntityReferenceFieldItemListInterface;
/**
* Convert an entity to an array and back.
*/
View -
diff --git a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php
index d7088eb7b..45d4d7f1f 100644
--- a/core/modules/node/src/Plugin/views/wizard/NodeRevision.php
+++ b/core/modules/node/src/Plugin/views/wizard/NodeRevision.php
@@ -2,6 +2,7 @@
namespace Drupal\node\Plugin\views\wizard;
+use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\wizard\WizardPluginBase;
View steps.md
  1. installimage
  2. Created two soft RAID 1 arrays, one 512MB /dev/md0, one 207G /dev/md1
  3. mount /dev/md0 /boot
  4. cp -a /boot .
  5. umount /boot
  6. mdadm -S /dev/md0
  7. mdadm --zero-superblock /dev/sdb1; mdadm --zero-superblock /dev/sda1
  8. gdisk /dev/sda
  9. add new partition, full size
  10. w (changing sda to GPT)
View gist:329c33825ec08aa222535a7a6bddc3d8
# Every migration that references a file by Drupal 7 fid should specify this
# migration as an optional dependency.
id: odl_file
label: Files
migration_tags:
- Drupal 7
source:
plugin: d7_file
scheme: public
constants:
You can’t perform that action at this time.