Skip to content

Instantly share code, notes, and snippets.

View andybroomfield's full-sized avatar

Andy Broomfield andybroomfield

View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active May 5, 2024 14:09
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@jenitehan
jenitehan / MyModuleRouteSubscriber.php
Created February 3, 2022 19:44
Set Drupal group parameter on a views page route with a group ID contextual filter.
<?php
namespace Drupal\my_module\EventSubscriber;
use Drupal\Core\Routing\RouteSubscriberBase;
use Drupal\Core\Routing\RoutingEvents;
use Symfony\Component\Routing\RouteCollection;
/**
* My module route subscriber.
@varjmes
varjmes / calm.js
Created March 25, 2021 22:39
Calm Mode Bookmarklet
javascript:(function () { const page = document.getElementsByTagName('html'); page[0].style.filter = 'saturate(50%)'})();
@nathanhleung
nathanhleung / FIX-MACOS-HANG.md
Last active February 24, 2024 08:25
Fix macOS Hanging Issue

Fix macOS Hanging Issue

Problem

Hey Apple users:

If you're now experiencing hangs launching apps on the Mac, I figured out the problem using Little Snitch.

It's trustd connecting to http://ocsp.apple.com >

Problem:
--------
Trying to get a test to use a custom handler, defaultConfiguration()
in QuizFormHandler references a configuration setting called 'training_program'.
In order for this to work properly during install, Drupal needs to know the schema
of any handlers that have configuration settings
Webform missing schema error
----------------------------
Drupal\Core\Config\Schema\SchemaIncompleteException :
@dpagini
dpagini / clear_varnish.sh
Created September 21, 2017 19:19
Acquia cloud hook function to clear varnish cache.
#!/bin/bash
varnish_purge() {
echo "@INFO: Clear varnish cache starting"
for domain in `$drush_cmd ac-domain-list --format=print_r`; do
echo "@INFO: Clearing varnish cache for $domain"
$drush_cmd ac-domain-purge $domain
done
@arturotena
arturotena / TrimJavaScriptPolyfill.js
Last active January 7, 2021 15:07
JavaScript trim() polyfill
/* trim ployfill: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim */
if (!String.prototype.trim) {
(function() {
// Make sure we trim BOM and NBSP
var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
String.prototype.trim = function() {
return this.replace(rtrim, '');
};
})();
}
@arunchinnachamy
arunchinnachamy / schema.xml
Last active October 16, 2020 12:09
Default schema.xml for tutorials in http://www.installationpage.com. Look in the comments for the link.
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@arunchinnachamy
arunchinnachamy / solrconfig.xml
Created April 5, 2013 09:48
Default SOLR Configuration file solrconfig.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0