Skip to content

Instantly share code, notes, and snippets.

@pbuyle
pbuyle / AsyncStreamHelpers.scala
Last active September 2, 2021 13:54
Untested Scala code to group com.twitter.concurrent.AsyncStream elements toghether. I wrote it thinking I needed it but was wrong. Manbe I will eventually need it. Maybe not. Maybe I will not remember this gist when I do. Maybe I got it all wrong.
View AsyncStreamHelpers.scala
import com.twitter.concurrent.AsyncStream
object AsyncStreamHelpers {
implicit class RichAsyncStream[T](val stream: AsyncStream[T]) {
/**
* Partitions this stream into sequences of adjacent elements grouped according to some discriminator function.
*
* This method will evaluation of this stream until its first element not belonging to the first group (ie. if the
* first element of the returned stream is a size of `n` then `n + 1` first element of this stream will be
* evaluated). Accessing each subsequent element of the resulting stream will evaluate another group of elements
View gist:7f140f6a55b9232cc7b5d373a170e473
Verifying my Blockstack ID is secured with the address 1NgvMCTCjVWieFSw47dNskw7HePTe7PNiY https://explorer.blockstack.org/address/1NgvMCTCjVWieFSw47dNskw7HePTe7PNiY
@pbuyle
pbuyle / keybase.md
Created October 16, 2017 13:36
keybase.md
View keybase.md

Keybase proof

I hereby claim:

  • I am pbuyle on github.
  • I am pbuyle (https://keybase.io/pbuyle) on keybase.
  • I have a public key ASB9qdFh6waGTWDNPznaOoUIM--VNmb7fIDmlUEkGaEfIAo

To claim this, I am signing this object:

@pbuyle
pbuyle / MODULE.module.php
Last active April 5, 2017 18:40
Integration of Pantheon with the Cache Expiration (expire) module on Drupal
View MODULE.module.php
<?php
/**
* Implements hook_init().
*/
function MODULE_init() {
// Add Surrogate-Key headers based on path segments.
// E.g. if the current path is product/some-category/product-name
// we should end up with the following Surrogate-Keys:
// product product/some-category product/some-category/product-name
@pbuyle
pbuyle / composer.json
Last active June 30, 2018 17:03
[Drupal] Redirects in settings.php with nikic/fast-route
View composer.json
{
...
"require": {
...
"nikic/fast-route": "^1.0"
...
}
...
}
@pbuyle
pbuyle / RoboFile.php
Last active March 21, 2018 16:51
Deploy to Pantheon with Robo
View RoboFile.php
<?php
/**
* This is project's console commands configuration for Robo task runner.
*
* @see http://robo.li/
*/
class RoboFile extends \Robo\Tasks {
use terminusLoadTasks;
@pbuyle
pbuyle / affirmation
Created April 23, 2015 15:11
MuleSoft Contributor Agreement Acceptance by Pierre Buyle
View affirmation
I, Pierre Buyle, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Thu Apr 23 2015 11:11:29 GMT-0400 (EDT)
@pbuyle
pbuyle / MODULE.install.php
Last active November 9, 2022 18:19
Drupal - Migrate existing field content from language "undefined" to entity language in a single hook_update_N() implementation.
View MODULE.install.php
<?php
/**
* Migrate existing field content from language "undefined" to entity language.
*/
function MODULE_update_N(&$sandbox) {
// Number of entities to be processed for each step.
$messages = array();
if (!isset($sandbox['fields'])) {
// Initialize the array of field to process.
@pbuyle
pbuyle / monitor.php
Last active August 29, 2015 14:04
Simple Drupal monitor script (avoid full bootstrap, check DB and cache availability)
View monitor.php
<?php
// OH HAI THARE
// NO CACH PLZ
header( "Cache-Control: no-cache, max-age=0, must-revalidate");
// SET ERROR HANDLR
set_error_handler('monitor_handle_error');
// CAN HAS DRUPAL BOOTSTRAP?
define('DRUPAL_ROOT', __DIR__);
chdir(DRUPAL_ROOT);
require_once 'includes/bootstrap.inc';
@pbuyle
pbuyle / FeatureContext.php
Last active August 9, 2021 12:31
Behat step-definition to verify visibility (not just presence) of Drupal form elements.
View FeatureContext.php
<?php
use Behat\Behat\Context\ClosuredContextInterface,
Behat\Behat\Context\TranslatedContextInterface,
Behat\Behat\Context\BehatContext,
Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
Behat\Gherkin\Node\TableNode;
/**