Skip to content

Instantly share code, notes, and snippets.

🚀

Matt Glaman mglaman

🚀
Block or report user

Report or block mglaman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mglaman
mglaman / OrderEventsSubscriber.php
Created Aug 13, 2019
Destructable performance wins
View OrderEventsSubscriber.php
<?php
namespace Drupal\commerce_stripe\EventSubscriber;
use Drupal\commerce_order\Event\OrderEvent;
use Drupal\commerce_order\Event\OrderEvents;
use Drupal\commerce_price\Calculator;
use Drupal\commerce_price\Price;
use Drupal\commerce_stripe\Plugin\Commerce\PaymentGateway\StripeInterface;
use Drupal\Core\DestructableInterface;
@mglaman
mglaman / drush-loop.php
Created Jul 7, 2019
ReactPHP Drupal Tasks
View drush-loop.php
<?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.
View FeatureContext.php
<?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 {
View FeatureContext.php
<?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.
View BigPipeContext.php
<?php
use Drupal\DrupalExtension\Context\RawDrupalContext;
use Behat\Mink\Exception\UnsupportedDriverActionException;
/**
* Big Pipe context.
*/
class BigPipeContext extends RawDrupalContext {
View gist:67af898f0f51ad9de1e1d3d3041200ff
{
"branch": "8.x-2.x",
"total": 222,
"contributors": {
"bojanz": 694,
"mglaman": 196,
"joshuataylorx": 69,
"vasike": 58,
"jelle.bekker": 40,
"agoradesign": 34,
View contributor-parser.php
<?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+\,?.*?):/',
View gist:8faddd08c00f34a98bca94fda267ef55
Verifying my Blockstack ID is secured with the address 16iSpbgeCNSYQQB91HkiPvVtDxHDx1Ct9d https://explorer.blockstack.org/address/16iSpbgeCNSYQQB91HkiPvVtDxHDx1Ct9d
View keybase.md

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:

View GenerateOrder.php
<?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;
You can’t perform that action at this time.