Skip to content

Instantly share code, notes, and snippets.

View apache-file-proxy.conf
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond ##DOMAIN## !^$
RewriteCond %{REQUEST_URI} ^/wp-content/uploads/[^\/]*/.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ##DOMAIN##/$1 [QSA,L]
</IfModule>
View ajax_links.patch
View facetapi_slider_disable_slider.patch
diff --git a/sites/all/modules/contrib/facetapi_slider/plugins/facetapi/widget_slider.inc b/sites/all/modules/contrib/facetapi_slider/plugins/facetapi/widget_slider.inc
index 47d176f4a..1e9d2d9ea 100644
--- a/sites/all/modules/contrib/facetapi_slider/plugins/facetapi/widget_slider.inc
+++ b/sites/all/modules/contrib/facetapi_slider/plugins/facetapi/widget_slider.inc
@@ -61,6 +61,9 @@ class FacetapiWidgetSlider extends FacetapiWidget {
$slider['#range_max'] = isset($slider['#range_max']) ? $slider['#range_max'] : $slider['#global_range_max'];
}
// Kanopi patch end
+ $this->build[$this->facet['field alias']][$this->facet['field']] = $slider;
+
@paulsheldrake
paulsheldrake / acf_url_as_html.php
Last active Oct 16, 2020
Output an ACF url field as html. Also allow for extra attributes.
View acf_url_as_html.php
/**
* Output ACF url field as HTML.
*
* Optionally add attributes to the link as an array.
*
* Example:
*
* acf_format_link('cp_flex_tab_1', ['class' => 'btn btn-large', 'data-id' => 123]);
*
* Will render the field like so.
@paulsheldrake
paulsheldrake / blazy_youtube_nocookie.patch
Created Oct 9, 2020
Update Blazy Drupal module to make all videos not autoplay and use the nocookie url.
View blazy_youtube_nocookie.patch
diff --git a/src/BlazyMedia.php b/src/BlazyMedia.php
index a996b32..7129204 100644
--- a/src/BlazyMedia.php
+++ b/src/BlazyMedia.php
@@ -46,6 +46,20 @@ class BlazyMedia {
$allow = $iframe_attributes['allow'] = 'autoplay; accelerometer; encrypted-media; gyroscope; picture-in-picture';
}
+ // Update Youtube to not be no-cookie and not autoplay.
+ if (strpos($iframe_attributes["data-src"], 'youtu') !== FALSE) {
View security_updates.sh
#!/bin/bash
# Find security updates
MODULE_LIST_FILENAME=module_list
rm $MODULE_LIST_FILENAME #This is just for local dev testing
touch $MODULE_LIST_FILENAME
terminus auth:login
terminus drush prepme.live -- ups --security-only --pipe > $MODULE_LIST_FILENAME
# Check if there are things to update
@paulsheldrake
paulsheldrake / Country codes
Created May 14, 2020
jVectormap World Map with all countries
View Country codes
AF : Afghanistan
AX : Aland Islands
AL : Albania
DZ : Algeria
AS : American Samoa
AD : Andorra
AO : Angola
AI : Anguilla
AG : Antigua and Barbuda
AR : Argentina
@paulsheldrake
paulsheldrake / jvectormap_parse_svg.php
Last active May 15, 2020
Parse an SVG to get data for jvectormap js file
View jvectormap_parse_svg.php
This file has been truncated, but you can view the full file.
<?php
$amchart_map_svg = '<?xml version="1.0" encoding="utf-8"?>
<!-- (c) ammap.com | SVG map of World - High -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:amcharts="http://amcharts.com/ammap" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1">
<defs>
<style type="text/css">
.land
{
fill: #CCCCCC;
View webform_remove_clear_button.patch
Index: webform.module
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- webform.module (revision cd7b2888fc53da871b69eb73fa23f6df5e252016)
+++ webform.module (date 1585660554035)
@@ -327,16 +327,16 @@
'file' => 'includes/webform.report.inc',
'type' => MENU_CALLBACK,
View pr-85-kanopi-2019.pantheonsite.io_2019-08-13_06-14-05.lighthouse.report.json
{"userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/74.0.3729.169 Safari/537.36","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3694.0 Mobile Safari/537.36 Chrome-Lighthouse","hostUserAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/74.0.3729.169 Safari/537.36","benchmarkIndex":1228},"lighthouseVersion":"5.0.0","fetchTime":"2019-08-13T13:14:05.525Z","requestedUrl":"http://pr-85-kanopi-2019.pantheonsite.io/","finalUrl":"https://pr-85-kanopi-2019.pantheonsite.io/","runWarnings":[],"audits":{"is-on-https":{"id":"is-on-https","title":"Does not use HTTPS","description":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, and is a prerequisite for HTTP/2 and many new web p