Skip to content

Instantly share code, notes, and snippets.

View Unifex's full-sized avatar

Gold Unifex

  • Ackama
  • Wellington, New Zealand
View GitHub Profile

Keybase proof

I hereby claim:

  • I am unifex on github.
  • I am unifex (https://keybase.io/unifex) on keybase.
  • I have a public key ASAT2XEazm64eApeq4pw3XtJTPu3s1ntfw-KrBT1P7YIugo

To claim this, I am signing this object:

@Unifex
Unifex / SkipOn404.php
Last active June 18, 2018 22:39
For... reasons I was working with bad data and a migration into Drupal 8 had me in a situation where I couldn't trust that the source file URL was actually present. The following is a migration process plugin that will check the URL and skip the row if it is a 404.
<?php
namespace Drupal\migrate_custom\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\MigrateSkipRowException;
use Drupal\migrate\Row;
use Drupal\Component\Utility\UrlHelper;
@Unifex
Unifex / ValueFromCsv.php
Created June 18, 2018 21:23
A Drupal 8 migration process plugin to to allow for fetching data from a CSV.
<?php
namespace Drupal\migrate_custom\Plugin\migrate\process;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;
/**
* Load a CSV and return a col for a specific row.
@Unifex
Unifex / NoOp.php
Created July 16, 2018 02:37
A Drupal 8 Migrate destination plugin that does nothing.
<?php
namespace Drupal\migrate_nbr\Plugin\migrate\destination;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Plugin\migrate\destination\DestinationBase;
use Drupal\migrate\Row;
/**
* Provides noop destination plugin.
@Unifex
Unifex / index.php
Created March 18, 2019 21:40
This file provides a practical test of using Chrome PHP and PHPUnite to create a PDF of multiple pages from the web.
<?php
/**
* @file
* A test of using Headless Chrome and the Linux CLI tool phpunite.
*
* Save this file to a directory.
* Run `composer require chrome-php/chrome` in the same directory
* If you are using Chromium run `export CHROME_PATH=chromium-browser`
* Run `php -S localhost:8080` to start a local server.