Skip to content

Instantly share code, notes, and snippets.

View weitzman's full-sized avatar

Moshe Weitzman weitzman

View GitHub Profile
weitzman / base.php
Created May 16, 2022 15:59
Webhook Twilio to Sheets
/* Ad hoc functions to make the examples marginally prettier.*/
function isWebRequest()
return isset($_SERVER['HTTP_USER_AGENT']);
function pageHeader($title)
weitzman / publish_credits.php
Created May 14, 2022 15:17
Get Assignees from GitLab API, format data and post to Google Sheets
#!/usr/bin/env php
require dirname(__DIR__) . '/vendor/autoload.php';
if (php_sapi_name() != 'cli') {
throw new Exception('This application must be run on the command line.');
$path_credentials = getenv('PUBLISH_CREDITS_CREDENTIALS') ?: 'credentials.json';
$path_token = getenv('PUBLISH_CREDITS_TOKEN') ?: 'token.json';
weitzman / Article.php
Created November 17, 2021 16:44
Bundle classes generated by Drush
namespace Drupal\drush_empty_module\Bundle\node;
* A bundle class for node entities.
class Article extends NodeBundleBase {
This release features significant new features and a major refactor of our site alias remote communication. If Drush had a marketing department, they would have insisted on the number 10.0. We don't, so 9.6.0 it is. We did our very best to preserve existing APIs - please report any breakage.
- Now 100% ✅ on Windows. All PRs tested for regressions (via Appveyor).
- Now 100% ✅ for sqlite and postgres databases. Mysql has always been ✅. Our test bots run these tests every night.
- Add --filter to many commands (#3718). You may now filter output from any tabular commands. An example: `drush pm:list --filter=ctools`. [See docs for details and general info about output formats](
- Deprecate drush_invoke_process(), and These are no longer used by Drush core and commandfiles are encouraged to use their replacements like Drush::drush(). These APIs will be removed in Drush 10. This is a HUGE win for the maintaina
weitzman / dtt_artifacts.txt
Created January 22, 2019 19:31
Example artifacts list during a Drupal Test Traits test
> phpunit --debug --colors --bootstrap=src/bootstrap.php --printer '\Drupal\Tests\Listeners\HtmlOutputPrinter' tests
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.
[snip errors]
Tests: 10, Assertions: 20, Errors: 5.
HTML output was generated
weitzman / ExampleTest.php
Last active January 22, 2019 18:52
A test class that leverages Drupal Test Traits
// Use your module's testing namespace such as the one below.
namespace Drupal\Tests\moduleName\ExistingSite;
use Drupal\taxonomy\Entity\Vocabulary;
use Drupal\user\Entity\User;
use weitzman\DrupalTestTraits\ExistingSiteBase;
Host *
IdentityFile /run/secrets/mass_id_rsa
eval `ssh-agent -s` > /dev/null 2>&1
ssh-add /var/run/secrets/mass_id_rsa
# 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
- 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