Skip to content

Instantly share code, notes, and snippets.

View crittermike's full-sized avatar

Mike Crittenden crittermike

View GitHub Profile
<?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.
@crittermike
crittermike / menu-local-task.html.twig
Last active February 8, 2019 08:54
Tailwind CSS styled tabs for Drupal 8 Twig. See https://tailwindcss.com/docs/examples/navigation#tabs
{#
/**
* @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.
*
@crittermike
crittermike / docksal.yml
Last active July 5, 2018 14:56
How to create a 2nd web container in Docksal
# 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}
@crittermike
crittermike / disable_aggregation.md
Last active February 14, 2022 12:17
Disabling CSS/JS aggregation via Drush in Drupal 7 and Drupal 8

Drupal 7

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

Drupal 8

@crittermike
crittermike / docker-compose.yml
Created November 1, 2017 18:23
An untested docker-compose.yml file to use with https://github.com/phase2/pattern-lab-starter/
version: '3.1'
services:
www:
container_name: plstarter_www
image: outrigger/apache-php:php71
network_mode: "bridge"
environment:
DOCROOT: /var/www/dest
volumes:

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
NICE TO MEET ME
@crittermike
crittermike / wget.sh
Last active March 26, 2024 22:49
Download an entire website with wget, along with assets.
# 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.
@crittermike
crittermike / .platform.app.yaml
Last active August 6, 2021 04:50
A sample .platform.app.yaml file for hosting Grav CMS on Platform.sh
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:
@crittermike
crittermike / rename.sh
Last active September 28, 2020 02:51
Mass renaming files on macOS using the "rename" command
# 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 **/*