Skip to content

Instantly share code, notes, and snippets.

@andyg5000
andyg5000 / usr.sbin.sshd
Created January 5, 2016 21:17
SSHD AppArmor profile
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2005 Novell/SUSE
# Copyright (C) 2012 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
@andyg5000
andyg5000 / DimensionalWeightSubscriber.php
Last active March 19, 2019 19:01
Commerce USPS Event Subcriber Example. Dimensional weights are automatically applied by the USPS Webtools API, but this file provides a solid example of how to manipluate the package array before a rate request is made. Make sure to register your event subscribers
<?php
/**
* Be sure to register this in your MYMODULE.services.yml file.
*
* MYMODULE_dimensional_weigth.rate_subscriber:
* class: Drupal\MYMODULE\EventSubscriber\DimensionalWeightSubscriber
* tags:
* - { name: event_subscriber }
*/
<?php
$pids = [3,15,19,23,25,28,30,31,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,88,91,93,95,97,99,101];
foreach ($pids as $pid) {
$profile = \Drupal\profile\Entity\Profile::load($pid);
$uid = $profile->get('uid')->getValue()[0]['target_id'];
/** @var \Drupal\profile\Entity\ProfileInterface $main_profile */
$main_profile = \Drupal::entityTypeManager()->getStorage('profile')->loadByProperties(['uid' => $uid, 'type' => 'main_profile']);
diff --git a/core/lib/Drupal/Core/Security/RequestSanitizer.php b/core/lib/Drupal/Core/Security/RequestSanitizer.php
index 8ba17b9..44815f6 100644
--- a/core/lib/Drupal/Core/Security/RequestSanitizer.php
+++ b/core/lib/Drupal/Core/Security/RequestSanitizer.php
@@ -2,6 +2,8 @@
namespace Drupal\Core\Security;
+use Drupal\Component\Utility\UrlHelper;
+use Symfony\Component\HttpFoundation\ParameterBag;
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 06acf93..d5963a0 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -2778,6 +2778,11 @@ function _drupal_bootstrap_variables() {
unset($_GET['destination']);
unset($_REQUEST['destination']);
}
+ // Use the DrupalRequestSanitizer to ensure that the destination's query
+ // parameters are not dangerous.
Verifying my Blockstack ID is secured with the address 1DCNP23vvZEQf6F9PBG6A3ji9rDua8NCcV https://explorer.blockstack.org/address/1DCNP23vvZEQf6F9PBG6A3ji9rDua8NCcV
diff --git a/html/header.html b/html/header.html
index 0718ed5..007f6a5 100644
--- a/html/header.html
+++ b/html/header.html
@@ -1,23 +1,4305 @@
<!DOCTYPE html>
<html class="no-js">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@andyg5000
andyg5000 / drushrc.php
Created February 10, 2016 19:18
Drush settings
<?php
/**
* @file
* Provides drush overrides for Blue Oak Interactive.
*/
$skip_tables = array(
'__ACQUIA_MONITORING',
);
@andyg5000
andyg5000 / comerce-discount-percentage-description-label.php
Created January 27, 2016 19:53
Update commerce discount percentage field description
<?php
$instance = field_info_instance('commerce_discount_offer', 'commerce_percentage', 'percentage');
$instance['description'] = 'Enter the percentage discount as a whole number';
field_update_instance($instance);