Skip to content

Instantly share code, notes, and snippets.

@davereid
davereid / keybase.md
Created September 12, 2017 23:07
keybase.md

Keybase proof

I hereby claim:

  • I am davereid on github.
  • I am davereid (https://keybase.io/davereid) on keybase.
  • I have a public key ASDGf14g9qrXwf7c9jNd4PaKxk_OWYiUERdPjK9TYlvSDAo

To claim this, I am signing this object:

<?php
use Drupal\user\Entity\User;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Session\AccountInterface;
/**
* Implements hook_entity_access().
*/
function entity_delete_protect_entity_access(EntityInterface $entity, $operation, AccountInterface $account) {

Parental leave

Being able to have parents have the bonding period with their new kid without worry from job or income is important to me.

Hillary Clinton:

Democratic nominee Hillary Clinton has proposed guaranteeing 12 weeks of paid family leave.

Donald Trump:

Typically you run a batch non-progressively like this:

batch_set($batch);
$batch = &batch_get();
$batch['progressive'] = FALSE;
batch_process();

But this does not work when running inside a SimpleTest. At least for SimpleTest via the UI, it runs in a batch itself. So messing with batch_set() and batch_get() here causes the SimpleTest batch runner to lose itself. Thankfully with one method we can easily run a batch from inside a SimpleTest:

<?php
/**
* @file
* Contains \Drupal\entity_embed\EntityEmbedDisplay\EntityEmbedFieldDisplay.
*/
namespace Drupal\entity_embed\EntityEmbedDisplay;
use Drupal\Component\Plugin\Factory\DefaultFactory;
davereid@Corsair250D ~/opt/PhpStorm-138.2001.2328/bin$ ./phpstorm.sh
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=350m; support was removed in 8.0
Maximum number of clients reachedException in thread "main" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at javax.swing.RepaintManager.<clinit>(RepaintManager.java:233)
at javax.swing.JComponent.repaint(JComponent.java:4792)
at java.awt.Component.repaint(Component.java:3313)
<?php
// This assumes used in Drupal and with https://www.drupal.org/project/helper installed.
$data = HttpHelper::getJson('https://api.github.com/users/drewboardman/events/public');
// Transform the array into an array of event types keyed by event ID.
$events = ArrayHelper::extractNestedValuesToArray($data, array('type'), array('id'));
// Build the array of score values, including any even types that have not been accounted for.
$score_values = array(
  • Sojos Certified Organic Catnip
  • Oberto All Natural Original Beef Jerky, X-Large 10 ounce package
  • Glad Tall Kitchen Drawstring Trash Bags, 13 Gallon, 90 Count
  • Rainbow Light, Prenatal One Multivitamin, 90 Tablets
  • Old Spice High Endurance, Original Scent Men's Anti-Perspirant & Deodorant 3 Oz (Pack of 6)
  • Pampers Sensitive Wipes 7x Box 448 Count
  • Pampers Sensitive Wipes 13x Multipack, 808 Count
  • Nivea For Men Platinum Protect Deodorizing Body Wash, Ocean Burst, 16.9-Ounce
  • Head & Shoulders Men Deep Clean Dandruff Shampoo 14.2 Fl Oz (packaging may vary)
  • Nutiva Organic Virgin Coconut Oil, 54oz, (Count of 2)
; Fix performance of path_delete() when there are no aliases to delete.
; @see https://www.drupal.org/node/1294964#comment-9158133
projects[drupal][patch][] = "https://www.drupal.org/files/issues/1294964-path-delete-performance-do-not-test.patch"
; Fix ordering of path aliases to always return the latest one
; @see https://www.drupal.org/node/1160764#comment-9173531
projects[drupal][patch][] = "https://www.drupal.org/files/issues/path_load_order-D7-do-not-test.patch"
; Fix "An AJAX HTTP request terminated abnormally" errors
; @see https://www.drupal.org/node/1232416#comment-8748879