Skip to content

Instantly share code, notes, and snippets.

View xjm's full-sized avatar

xjm xjm

View GitHub Profile
@xjm
xjm / gist:2244c58c031a46fe9d48001c6a3dff97
Last active September 25, 2023 18:57
Parts of xjm's .bash_profile
# Make git branch tab completion possible
if [ -f ~/.git-completion.bash ]; then
. ~/.git-completion.bash
fi
# Resets a Drupal installation (destroying all data) without reinstalling.
# Run this command directly to clean up the old installation before
# reinstalling manually.
function drupal-reset() {
# Remove existing database.
@xjm
xjm / meetings.js
Last active October 12, 2019 03:00 — forked from justafish/meetings.js
const data = require('../Downloads/Slack/diversity-inclusion/2019-03-07.json');
const usersExport = require('../Downloads/Slack/users.json');
// Load all users into memory.
const users = {};
const contributors = {};
usersExport.forEach(user => {
users[user.id] = user.profile.display_name_normalized ? user.profile.display_name_normalized : user.profile.real_name_normalized;
});
Hi Keith! A couple corrections on your post:
<blockquote>
While developing a migration module, you will often need to make changes to your migration definitions. Because these are configuration entities, you will need to reinstall your module for any changes to take effect.
Additionally, since Drupal 8 beta 2, Drupal modules no longer delete their configuration when they are uninstalled. Therefore, you will need to write a quick uninstall hook to handle this.
</blockquote>
This isn't exactly true. If your configuration actually <em>depends</em> on your module, it will be automatically deleted. In the case of the module you've described here, the configuration is actually owned by (and depends on) Migrate. So if you were to uninstall <em>Migrate</em>, then it would be deleted. For the most part, configuration dependencies are calculated automatically, and if there is a hard dependency, either the config will be automatically deleted, or you won't be able to uninstall the module until content that depends on
@xjm
xjm / gist:fa740a44491bf8bdba62
Last active August 29, 2015 14:15
Run a D8 test from a clean install
# Obviously, replace the site location and DB credentials with yours.
# Resets a Drupal installation (destroying all data) without reinstalling.
# Run this command directly to clean up the old installation before
# reinstalling manually.
function drupal-reset() {
# Remove existing database.
drush sql-drop -y;
# Remove existing installation.
sudo rm -rf sites/default;
<?php
/**
* @file
* flag/flag.views.inc
* /
/**
* Implements hook_views_data().
* /
core/modules/field/lib/Drupal/field/Plugin/views/relationship/EntityReverse.php
core/modules/taxonomy/lib/Drupal/taxonomy/Plugin/views/relationship/NodeTermData.php
core/modules/views/lib/Drupal/views/Annotation/ViewsRelationship.php
core/modules/views/lib/Drupal/views/Plugin/views/join/JoinPluginBase.php
core/modules/views/lib/Drupal/views/Plugin/views/relationship/Broken.php
core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.php
core/modules/views/lib/Drupal/views/Plugin/views/relationship/RelationshipPluginBase.php
core/modules/views/lib/Drupal/views/Plugin/views/relationship/Standard.php
@xjm
xjm / d8_threshold_issues_by_component
Created June 9, 2013 20:00
8.x threshold issues by component, using data from around 2013-05-01.
mysql> select count(pic.nid) as issues, pic.component
-> from project_issue_comments pic
-> inner join project_issues pi on pic.comment_number = pi.last_comment_id and pi.nid = pic.nid
-> where pic.pid=3060 -- core
-> and pic.sid in(1, 4, 8, 13, 14) -- active, postponed, NR, NW, RTBC
-> and pic.priority in(1, 4) -- critical, major
-> and pic.category in ('bug', 'task')
-> and pic.rid=572834 -- 8.x
-> group by pic.component
-> order by issues desc
#!/usr/bin/env ruby
require 'pp'
contributors = Hash.new(0)
%x[git log 8.x --since=2011-03-09 -s --format=%s].split("\n").each do |m|
m.scan(/\s(?:by\s?)([\w\s,.]+)[( | ):]/i).each do |people|
people[0].split(',').each do |p|
p = p.gsub(/et all?/, '')
p.strip!
contributors[p] += 1 unless p.nil?