Skip to content

Instantly share code, notes, and snippets.

View weitzman's full-sized avatar

Moshe Weitzman weitzman

View GitHub Profile
#
# Copy and rename this file to .env at root of this project.
#
# Set a docker caching specification for the code mount.
#
# File access in hosted volumes can be very slow on Mac due to issues with the
# filesystem. Using cached or delegated here can really speed things up, but
# this isn't a cross-platform feature.
# See https://docs.docker.com/compose/compose-file/#caching-options-for-volume-mounts-docker-for-mac
- run: docker-compose stop --timeout 30 mysql
- run: docker login -u $DOCKER_USER -p $DOCKER_API_KEY
- run: docker commit $(docker-compose ps -q mysql) mass/mysql-sanitized:latest
- run: docker push mass/mysql-sanitized:latest
@weitzman
weitzman / config.diff
Last active November 10, 2017 13:20
Purger config mismatch - https://www.drupal.org/node/2922493
ubuntu@box921:~/mass$ git diff
diff --git a/conf/drupal/config/purge.logger_channels.yml b/conf/drupal/config/purge.logger_channels.yml
index e16c732..e5b869d 100644
--- a/conf/drupal/config/purge.logger_channels.yml
+++ b/conf/drupal/config/purge.logger_channels.yml
@@ -11,15 +11,3 @@ channels:
- 0
- 2
- 3
- -
@weitzman
weitzman / blog.md
Last active September 29, 2017 10:07
Porting Commands to Drush9

Drush 9 features a deep rewrite of our app, both user facing and internals. We created and open sourced AnnotatedCommand, OutputFormatters, and Config. We leveraged Symfony Console for our CLI fundmentals. For details on Drush9, see the video or slides from our Drupalcon Vienna presentation.

** ADD AN ANNOTATED COMMAND EXAMPLE **

Unfortunately, old commandfiles such as example.drush.inc no longer load in Drush 9. We've made it relatively painless to port this code to Drush 9:

** ADD A GIF OF GENERATOR **

  1. Using Drush 9 on a working site, run drush generate drush-command-file. generate is a wrapper for the Drupal Code Generator
@weitzman
weitzman / FeatuesCommands.php
Created June 11, 2017 11:15
Port Features to Drush9
<?php
namespace Drupal\features\Commands;
use Consolidation\OutputFormatters\StructuredData\RowsOfFields;
use Drupal\Component\Diff\DiffFormatter;
use Drupal\config_update\ConfigDiffInterface;
use Drupal\Core\Config\StorageInterface;
use Drupal\features\FeaturesAssignerInterface;
use Drupal\features\FeaturesGeneratorInterface;
use Drupal\features\FeaturesManagerInterface;
@weitzman
weitzman / # php56 - 2017-05-08_16-14-13.txt
Created June 7, 2017 14:43
php56 (homebrew/php/php56) on macOS 10.11.6 - Homebrew build logs
Homebrew build logs for homebrew/php/php56 on macOS 10.11.6
Build date: 2017-05-08 16:14:13
Outside the VM
In PHPStorm,
Run => Start Listening for PHP Connections
Run => Break at first line in PHP scripts
Inside the VM
Navigate to docroot and run:
XDEBUG_CONFIG="idekey=phpstorm remote_host=`netstat -rn | grep "^0.0.0.0 " | tr -s ' ' | cut -d " " -f2`" php -dzend_extension=xdebug.so -d xdebug.remote_enable=1 ../vendor/bin/drush st
Sets the XDEBUG_CONFIG environment variable. The value has two components:
@weitzman
weitzman / drush8
Created May 12, 2017 15:30
drush8 wrapper when inside a a drush9 composer project. This didn't work out due to Drush8's finder finding drush9 anyway.
#!/usr/bin/env sh
SELF_DIRNAME="`dirname -- "$0"`"
PATH=$SELF_DIRNAME:$PATH DRUSH_FINDER_SCRIPT="foo" drush.phar "$@"
@weitzman
weitzman / MigrationIsRunning.php
Created April 20, 2017 14:12
Determine if a migration is running
<?php
namespace Drupal\ras_comments;
use Drupal\migrate\Event\MigrateEvents;
use Drupal\migrate\Event\MigrateImportEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
In conjunction with *HYPERLINK NEEDED*Wednesday's Drupal Contribution Ladder session, opportunities throughout the week in a smaller setting are being offered to meet Drupal contributors that help oversee the development of Drupal core. You will climb the ladder for their subsystem, and author lessons for future Drupal contributors.
For the first part of the session, the maintainer will give a brief overview of their Drupal subsystem or project, its current progress, upcoming roadmap, and how folks can get involved. For the remaining part of the session, attendees will contribute to the presenter's core Drupal component or initiative through various hands-on activities offered by the Drupal Contribution Ladder.
Dialogue may cover topics like:
What are some common myths or oversights around their project goals?
What are concepts folks often are confused by?
What are some good learning resources out there?
And how can community members contribute a lesson plan back to "the ladder?"