Skip to content

Instantly share code, notes, and snippets.

Avatar

Mike Crittenden mikecrittenden

View GitHub Profile
View EntityReferenceMultipleFormatter.php
<?php
namespace Drupal\entityreference_multiple\Plugin\Field\FieldFormatter;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceEntityFormatter;
/**
* Plugin implementation of the 'entityreference_entity_multiple_view' formatter.
View menu-local-task.html.twig
{#
/**
* @file
* Theme override for a local task link.
*
* Available variables:
* - attributes: HTML attributes for the wrapper element.
* - is_active: Whether the task item is an active tab.
* - link: A rendered link element.
*
@mikecrittenden
mikecrittenden / docksal.yml
Last active Jul 5, 2018
How to create a 2nd web container in Docksal
View docksal.yml
# Web 2 (name it anything you want, doesn't have to be "web2")
web2:
extends:
file: ${HOME}/.docksal/stacks/services.yml
service: web
environment:
- APACHE_DOCUMENTROOT=/var/www/your-web2-directory
labels:
- io.docksal.virtual-host=web2.${VIRTUAL_HOST}
@mikecrittenden
mikecrittenden / disable_aggregation.md
Last active Mar 5, 2021
Disabling CSS/JS aggregation via Drush in Drupal 7 and Drupal 8
View disable_aggregation.md

Drupal 7

drush vset preprocess_css 0 --yes
drush vset preprocess_js 0 --yes

Drupal 8

View docker-compose.yml
version: '3.1'
services:
www:
container_name: plstarter_www
image: outrigger/apache-php:php71
network_mode: "bridge"
environment:
DOCROOT: /var/www/dest
volumes:
View postmortem.md

YYYY-MM-DD Post Mortem

Property Information
Impact Describe the impact of this incident
Status Ongoing/Resolved
Date of Incident When did this incident occur
Time Window Start and end time for this incident
Total Time How long (hours/minutes) did this incident last
JIRA Issue(s) Ticket number for any related JIRA tickets
@mikecrittenden
mikecrittenden / wget.sh
Last active Sep 25, 2021
Download an entire website with wget, along with assets.
View wget.sh
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@mikecrittenden
mikecrittenden / .platform.app.yaml
Last active Aug 6, 2021
A sample .platform.app.yaml file for hosting Grav CMS on Platform.sh
View .platform.app.yaml
name: grav_app # Rename this to whatever you want.
type: php:7.1
disk: 1024
web:
locations:
"/":
root: "app" # Assuming Grav lives in an app/ directory.
passthru: /index.php
expires: 1h
mounts:
@mikecrittenden
mikecrittenden / rename.sh
Last active Sep 28, 2020
Mass renaming files on macOS using the "rename" command
View rename.sh
# Install it with Homebrew.
brew install rename
# Replace "oldstring" with "newstring" with files in the current directory.
rename -s oldstring newstring *
# Do the same thing, but recursively.
rename -s oldstring newstring **/*