Skip to content

Instantly share code, notes, and snippets.

View sheanhoxie's full-sized avatar

Shean Hoxie sheanhoxie

View GitHub Profile
@sheanhoxie
sheanhoxie / settings.local.php
Created July 27, 2022 23:26
Drupal 8/9 local settings file with Lando DB credentials
<?php
// phpcs:ignoreFile
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
@sheanhoxie
sheanhoxie / Drupal-8--base-field-types
Created July 16, 2021 20:59
A list of base field types for Drupal 8+
boolean
changed
comment
created
datetime
decimal
email
entity_reference
file
float
@sheanhoxie
sheanhoxie / .lando.yml
Created April 22, 2021 00:29
Lando - Drupal 9 recipe w/ extras: Drush 10, Redis, Vim, Zsh
name: drupal9
recipe: drupal9
config:
webroot: web
database: mariadb
xdebug: true
php: 7.4
drush: ~10
excludes:
@sheanhoxie
sheanhoxie / settings.local.php
Created April 22, 2021 00:24
Drupal 9 + Lando + Redis settings.local.php
<?php
// @codingStandardsIgnoreFile
/**
* @file
* Local development override configuration feature.
*
* To activate this feature, copy and rename it such that its path plus
* filename is 'sites/default/settings.local.php'. Then, go to the bottom of
@sheanhoxie
sheanhoxie / using_drupal_form_display.md
Last active April 22, 2021 17:24
Using Drupal's Form Display, we can create variations of a form. This can be helpful in a few ways, including creating simplified forms for different user roles
@sheanhoxie
sheanhoxie / How to use form display to create form variations
Created December 17, 2020 18:59
Using Drupal's Form Display, we can create variations of a form. This can be helpful in creating simplified forms for different user roles
h1. Creating a variation of an entity form
1. [UI](#ui)
1.1 [Create the Form Mode](#create_form_mode)
1.2 [Activate the Form Display](#activate_form_display)
1.3 [Edit Form Display as needed](#edit_form_display)
2. [Code](#code)
2.1 [Create the Form](#create_form)
2.2 [Create the route](#create_route)
2.3 [Attach the form display using hook_entity_type_build()](#attach_form_display)
@sheanhoxie
sheanhoxie / convert images to webp
Last active March 24, 2023 18:30
script to convert all images in a directory to webp, on mac osx
// Install webp via Brew
brew install webp
cwebp [-preset <...>] [options] in_file [-o out_file]
options:
-o outfile
-q <float> quality 0-100
-alpha_q <int> transparency compression 0-100
-preset <string> default, photo, picture, drawing, icon, text
-preset must come first
@sheanhoxie
sheanhoxie / tar folder, minus videos, images, etc
Last active February 13, 2020 14:52
Use when you want to archive a folder without all the heavy files
Using exclude
============================
--exclude=pattern
tar --exclude={*.mp4,*.mov,*.wav,*.wmv,*.mpg,*.mpeg,*.flv,*.avi,*.ogv,*.ogg,*.webm,*.wav,*.mp3,*.wma,*.7z,*.gz,*.tar,*.zip,*.sql,*.jpg,*.gif,*.png,*.svg,*.ico} -cvf output.file.tar input.file
Using exclude with text file
============================
-X file
Create a few shell scripts so that you can enable/disable xdebug easily on Mac OSX using Brew
create file
===========
touch xdebug-enable.sh
edit file contents
==================
vim xdebug-enable.sh