Skip to content

Instantly share code, notes, and snippets.

View JonMcL's full-sized avatar

Jonathan McLaughlin JonMcL

View GitHub Profile
@JonMcL
JonMcL / gist:885be369403217cc9934382eba52db0f
Created July 5, 2022 19:56
ddev enabled on tryddevproject-12898
C:\Users\jmclaughlin\tmp\tryddevproject-12898>dir
Volume in drive C is Windows
Volume Serial Number is F4A3-09FB
Directory of C:\Users\jmclaughlin\tmp\tryddevproject-12898
07/05/2022 03:40 PM <DIR> .
07/05/2022 03:40 PM <DIR> ..
07/05/2022 03:41 PM <DIR> .ddev
07/05/2022 03:40 PM 292 index.php
@JonMcL
JonMcL / gist:03bc293cc735c4258f9d5f1eaaa46d26
Created July 5, 2022 19:50
An empty/new ddev-test project with and without mutagen-enabled
C:\Users\jmclaughlin\ddev\ddev-test>ddev config --mutagen-enabled=false
You are reconfiguring the project at C:\Users\jmclaughlin\ddev\ddev-test.
The existing configuration will be updated and replaced.
Found a php codebase at C:\Users\jmclaughlin\ddev\ddev-test
Project type has no settings paths configured, so not creating settings file.
Configuration complete. You may now run 'ddev start'.
C:\Users\jmclaughlin\ddev\ddev-test>ddev start
Network ddev_default created
Starting ddev-test...
❯ ddev debug test
Running C:\Program Files\Git\bin\bash.exe [-c /c/Users/JMCLAU~1/AppData/Local/Temp/test_ddev.sh]
OS Information: MINGW64_NT-10.0-19043 SCOPE-2020-034 3.1.7-340.x86_64 2021-10-12 16:29 UTC x86_64 Msys
User information: uid=4096(SCOPE+jmclaughlin) gid=4096 groups=4096
DDEV version: ITEM VALUE
DDEV version v1.19.3
architecture amd64
db drud/ddev-dbserver-mariadb-10.3:v1.19.3
dba phpmyadmin:5
ddev-ssh-agent drud/ddev-ssh-agent:v1.19.0
@JonMcL
JonMcL / .gitattributes
Last active June 4, 2019 16:57
gitattributes file for Unity builds
# Unity Build files
*.dll -text
*.assets -text
*.resS -text
*.aspx -text
*.config -text
config -text
*.map -text
*.ini -text
*.xml -text
@JonMcL
JonMcL / og_components.module.php
Last active June 20, 2018 19:31
Example of excluding/hiding a Drupal paragraph entity if the referenced entity is un-published (or otherwise not available to current user).
<?php
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Access\AccessResult;
/**
* Implement hook_paragraph_access.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
@JonMcL
JonMcL / style-tests.js
Last active February 14, 2018 14:14
Adds one or more classes to document root for CSS tests. Classes persist through session.
/**
* Simple utility function to add special classes, prefixed with 'style-test' into
* the document.
*
* Example:
* ?style-test=test1+test2
* Adds classes: style-test-test1 style-test-test2
*
*/
(function(Document, window) {
@JonMcL
JonMcL / add_js_to_root_before_load.js
Last active December 26, 2017 20:13
Simple Javascript to force 'js' class into document root as soon as <head> is loaded and parsed. This happens before CSS and before JS assets are loaded. Also removes 'no-js' if it is there.
<script type="text/javascript">
var root = document.documentElement;
if (root.classList) {
root.classList.add('js');
root.classList.remove('no-js');
}
else {
root.className += ' js';
var regex = new RegExp('(\\s|^)' + 'no-js' + '(\\s|$)');
el.className = root.className.replace(regex, ' ');
@JonMcL
JonMcL / settings.php
Last active September 14, 2017 16:17
Redirect to www and https in Pantheon server environments. Add to Drupal 7 settings.php file.
/**
* Pantheon HTTPS and www redirects.
*/
if (isset($_SERVER['PANTHEON_ENVIRONMENT']) && php_sapi_name() !== 'cli') {
$domain = $_SERVER['HTTP_HOST'];
$www_redirect = false;
if (isset($_ENV['PANTHEON_ENVIRONMENT']) && $_ENV['PANTHEON_ENVIRONMENT'] === 'live') {
if (count(explode('.', $domain)) < 3 && stripos($domain, 'www.') === false) {
$domain = 'www.' . $domain;
$www_redirect = true;
@JonMcL
JonMcL / gist:f802c4eb844452835c0f
Created December 15, 2014 18:55
CSS Vertical Centering Holy Grail?
/* From: http://css-tricks.com/centering-in-the-unknown/ */
/* This parent can be any width and height */
.block {
text-align: center;
}
/* The ghost, nudged to maintain perfect centering */
.block:before {
content: '';