Skip to content

Instantly share code, notes, and snippets.

View paulsheldrake's full-sized avatar

Paul Sheldrake paulsheldrake

  • Vancouver, Canada
View GitHub Profile
@paulsheldrake
paulsheldrake / views-view-unformatted.html.twig
Last active August 24, 2023 10:35
Field level data for Views rows in Drupal 8.
{#
/**
* @file
* Theme override to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
* - attributes: The row's HTML attributes.
* - content: The row's content.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR]
RewriteCond %{DOCUMENT_ROOT}/$1 -d
RewriteRule (.*) - [L]
#
# Else proxy
RewriteRule ^/(.*)$ ##DOMAIN##/$1 [P,QSA]
ProxyPassReverse / ##DOMAIN##
@paulsheldrake
paulsheldrake / Country codes
Created May 14, 2020 18:02
jVectormap World Map with all countries
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 / facetapi_slider_disable_slider.patch
Last active December 15, 2020 00:21
disable the jquery slider
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 October 16, 2020 23:17
Output an ACF url field as html. Also allow for extra attributes.
/**
* 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 October 9, 2020 18:02
Update Blazy Drupal module to make all videos not autoplay and use the nocookie url.
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) {
#!/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 / jvectormap_parse_svg.php
Last active May 15, 2020 12:54
Parse an SVG to get data for jvectormap js file
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;
fill-opacity: 1;
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,