Skip to content

Instantly share code, notes, and snippets.

View xurizaemon's full-sized avatar
🌻
SPRING

Chris Burgess xurizaemon

🌻
SPRING
View GitHub Profile
@xurizaemon
xurizaemon / TransformUid.php
Created November 6, 2018 10:12
transforming uid=1 to uid=3, leave the rest the same
<?php
namespace Drupal\foo_migrate\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
/**
* Replace uid=1 with uid=3
@xurizaemon
xurizaemon / drupal-logger-console-colours.php
Last active November 6, 2018 02:53
Drush & Drupal logger output
<?php
foreach (['alert', 'critical', 'debug', 'emergency', 'error', 'info', 'notice', 'warning'] as $type) {
\Drupal::logger('foo')
->$type('This is a message of type @type', ['@type' => $type]);
}
commit 6f867351ee0161586af846e31b2fed9817d1d964
Author: Chris Burgess <chrisburgess@catalyst.net.nz>
Date: Tue Nov 6 09:36:56 2018 +1300
Issue #2998712: Replace drupal_set_message() with \Drupal::messenger()->addMessage()
diff --git a/modules/mailchimp_campaign/mailchimp_campaign.module b/modules/mailchimp_campaign/mailchimp_campaign.module
index 268fc76..6134969 100644
--- a/modules/mailchimp_campaign/mailchimp_campaign.module
+++ b/modules/mailchimp_campaign/mailchimp_campaign.module
@xurizaemon
xurizaemon / AliasStorage.php
Created November 2, 2018 19:09
modified Drupal\Core\Path\AliasStorage.php to drop PgSQL ILIKE + cast for performance
<?php
namespace Drupal\Core\Path;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\SchemaObjectExistsException;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\Core\Database\Query\Condition;
--- /tmp/odttheme-1.yml 2018-10-19 14:37:13.890125273 +1300
+++ /tmp/odttheme-2.yml 2018-10-19 14:37:32.626574674 +1300
@@ -1,4 +1,4 @@
-# before update
+# after update
# vagrant@odt-d7:~$ drush vget odttheme
rules_debug_region_odttheme: help
theme_odttheme_settings:
@@ -17,24 +17,43 @@
default_favicon: 1
--- /tmp/odttheme-1.yml 2018-10-19 14:37:13.890125273 +1300
+++ /tmp/odttheme-2.yml 2018-10-19 14:37:32.626574674 +1300
@@ -1,4 +1,4 @@
-# before update
+# after update
# vagrant@odt-d7:~$ drush vget odttheme
rules_debug_region_odttheme: help
theme_odttheme_settings:
@@ -17,24 +17,43 @@
default_favicon: 1

gist by ID only:

{{gist(4033291)}}

gist with ID and filename:

{{gist(4033291,README.md)}}

gist by new longer ID:

@xurizaemon
xurizaemon / broken.md
Created September 25, 2018 18:27
quote on sorrsupport requests from "my year without pants"

"In some cases, customers simply write: “My blog is broken,” which is sad, of course, but also infinitely vague. No one wants a broken blog, but this message is useless in helping solve the problem. It's like calling 911 and saying, “Save me,” again and again and again as if the problem is in the person on the other line not realizing you need to be saved. That's never the problem, as the person on the other end saves people all day long. That's the entire job: waiting for people who need to be saved to call. There is a lazy imagination that takes over when we're in a crisis. We behave as if the universe has shifted and shrunk down, placing our problem in the center of everyone's lives. And if that weren't enough, we assume omnipotence in the people we believe can help us—that somehow they know everything about us and what we were trying to do, as well as how to instantly fix it. Altogether it's tickets like these that are extra sad because their lack of detail guarantees there will be no immediate relief. Th

@xurizaemon
xurizaemon / Ahikāroa-phrases.js
Last active September 25, 2018 22:27
He mea pai te "Ahikāroa" (https://www.ahikaroa.nz/), me he mea reka nga kianga ō te ra. Anei nga kianga!
// https://www.ahikaroa.nz/phrase-of-the-day
document.querySelectorAll('.module-potd__panel').forEach((el) => {
mi = el.querySelectorAll('.module-potd__panel-title')
en = el.querySelectorAll('.module-potd__panel-subtitle')
if (mi.length && en.length) {
console.log(mi[0].innerText, en[0].innerText)
}
})
~/S/civicrm-buildkit-vagrant (40-use_dot_test_tld|✚1) $ time vagrant up
/Users/chris/.vagrant.d/gems/2.4.3/gems/rubyhacks-0.1.5/lib/rubyhacks.rb:536: warning: constant ::Fixnum is deprecated
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty64' is up to date...
==> default: A newer version of the box 'ubuntu/trusty64' for provider 'virtualbox' is
==> default: available! You currently have version '20180917.0.0'. The latest is version
==> default: '20180919.0.0'. Run `vagrant box update` to update.
==> default: Setting the name of the VM: civicrm-buildkit-vagrant