Skip to content

Instantly share code, notes, and snippets.

View twfahey1's full-sized avatar

Tyler Fahey twfahey1

View GitHub Profile
@twfahey1
twfahey1 / gh action snippet
Created July 28, 2020 12:39
GitHub actions snippet to install apache
- name: Install Apache
run: |
pwd
sudo apt update
sudo apt install apache2
echo "GETTING ADMIN PERMS SETUP"
sudo adduser $(whoami) www-data
sudo adduser $(whoami) root
@twfahey1
twfahey1 / README.md
Created August 13, 2020 13:59 — forked from jleehr/README.md
[Drupal 8] Alter route (permissions) for taxonomy vocabulary page

[Drupal 8] Alter route (permissions) for taxonomy vocabulary page

Needs the patch: https://www.drupal.org/node/1848686

Split "Administer vocabularies and terms" permission: Access the taxonomy overview page and Add terms in vocabulary name

File structure:

mymodule
|- src
@twfahey1
twfahey1 / css-media-queries
Created August 26, 2020 03:19 — forked from bluehazetech/css-media-queries
CSS: SCSS Breakpoints, Mixins and Usage
/*------------------------------------*\
breakpoint vars
\*------------------------------------*/
$break-320: 20em;
$break-321: 20.0625em;
$break-480: 30em;
$break-600: 37.5em;
$break-768: 48em;
$break-980: 61.25em;
$break-1024: 64em;
@twfahey1
twfahey1 / command.php
Created September 10, 2020 14:44
Custom clear cache WP CLI plugin example
<?php
/*
Plugin Name: Custom clear cache
Description: Clears out the custom cache code
Author: Tyler Fahey
Version: 1.0.0
Author URI: https://tylerfahey.com
*/
class CCC_CLI {
Drupal.behaviors.mybehavior = {
attach: function (context, settings) {
$('#some_element', context).once('mybehavior', function () {
// Code here will only be applied to $('#some_element')
// a single time.
});
}
};
@twfahey1
twfahey1 / get-modules-from-non-composer.sh
Created January 13, 2021 15:07
Script for discovering and requiring Drupal modules via composer
allmodules="";
# Tweak these excluded as needed. Pesky modules, erroneous folders, etc. that are not modules.
# Keep in mind all files in the source folder will be scanned and use in the composer require statement.
excluded=("contrib" "custom" "README.txt" "platform" "config_split")
# Tweak location as needed for wherever script is being run.
for f in $(ls /Users/tylerfahey/Sites/pantheon-sites/wpccu2019/modules); do
# TODO: Check if module is in excluded list and ignore if so.
if [[ " ${excluded[@]} " =~ " ${f} " ]]; then
# whatever you want to do when array contains value
echo "ignoring $f"
@twfahey1
twfahey1 / clean-git.sh
Created January 26, 2021 16:46
Sanitize all git folders in subdirectories
# Temporarily move current .git to not purge it.
mv .git .gitbackup
mv .gitignore .gitignorebackup
# Purge all gits
find . \( -name ".git" -o -name ".gitignore" -o -name ".gitmodules" -o -name ".gitattributes" \) -exec rm -rf -- {} +
# Put back original git
mv .gitbackup .git
@twfahey1
twfahey1 / gist:a2f46a2ed8a7b2186b96f58e525eac13
Last active March 30, 2021 16:41
Get JSON:API Extra path prefix config string via php-script terminus for Pantheon site
cat << 'EOF' | terminus drush mysite.dev -- php-script -
$config = \Drupal::config('jsonapi_extras.settings')->get('path_prefix');
echo $config;
EOF
@twfahey1
twfahey1 / .zshrc
Created August 18, 2021 11:35
Terminal setup
ZSH_THEME="dracula"
# DRACULA_ARROW_ICON="-> "
parse_git_branch() {
git branch 2> /dev/null | sed -n -e 's/^\* \(.*\)/[\1]/p'
}
COLOR_DEF='%f'
COLOR_USR='%F{243}'
COLOR_DIR='%F{180}'
COLOR_GIT='%F{39}'
NEWLINE=$'\n'
@twfahey1
twfahey1 / mymodule.links.menu.yml
Created September 1, 2021 04:48
Add a top level admin bar menu route in D8+