Skip to content

Instantly share code, notes, and snippets.

View mglaman's full-sized avatar

Matt Glaman mglaman

View GitHub Profile
@mglaman
mglaman / drush-loop.php
Created July 7, 2019 02:28
ReactPHP Drupal Tasks
<?php declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
function run_command(string $command): void {
$loop = React\EventLoop\Factory::create();
$process = new React\ChildProcess\Process($command);
$process->start($loop);
$process->on('exit', function ($exitCode) use ($command) {
// Trigger alerts that the command finished.
<?php
/**
* @When I switch to the frame by selector "[title=:arg1]"
*/
public function switchToIFrameFromSelector($iframeSelector) {
$function = <<<JS
(function(){var iframe = document.querySelector("$iframeSelector");iframe.name = "iframeToSwitchTo";})()
JS;
try {
<?php
use Behat\Mink\Driver\GoutteDriver;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Behat\Context\SnippetAcceptingContext;
/**
* Defines application features from the specific context.
<?php
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Mink\Exception\UnsupportedDriverActionException;
/**
* Big Pipe context.
*/
class BigPipeContext extends RawDrupalContext {
{
"branch": "8.x-2.x",
"total": 222,
"contributors": {
"bojanz": 694,
"mglaman": 196,
"joshuataylorx": 69,
"vasike": 58,
"jelle.bekker": 40,
"agoradesign": 34,
@mglaman
mglaman / contributor-parser.php
Last active December 22, 2017 22:06
Parsing things
<?php
$git_command = 'git --git-dir=./.git log 8.x-2.x --format="%ae||%s" -s --no-merges --reverse';
$contributors = [];
$commits = [];
$fallback_commits = [];
$regex = [
'issue' => '/by (\w+\,?.*?):/',
Verifying my Blockstack ID is secured with the address 16iSpbgeCNSYQQB91HkiPvVtDxHDx1Ct9d https://explorer.blockstack.org/address/16iSpbgeCNSYQQB91HkiPvVtDxHDx1Ct9d

Keybase proof

I hereby claim:

  • I am mglaman on github.
  • I am mglaman (https://keybase.io/mglaman) on keybase.
  • I have a public key whose fingerprint is 2B34 E356 BC54 3347 9860 5399 2F5A 8527 D634 3B7D

To claim this, I am signing this object:

<?php
namespace Drupal\commerce_demo;
use Drupal\commerce\EntityHelper;
use Drupal\commerce_price\RounderInterface;
use Drupal\commerce_product\Entity\ProductVariationInterface;
use Drupal\commerce_store\Entity\Store;
use Drupal\Component\Serialization\Json;
use Drupal\Core\Entity\EntityTypeManagerInterface;
@mglaman
mglaman / config.yml
Created April 19, 2017 13:31
DrupalVM where update tasks fail.
---
extra_packages:
- sqlite
- php-bcmath
# Composer project settings.
drupal_build_composer_project: false
drupal_build_composer: false
drupal_composer_dependencies: []