Skip to content

Instantly share code, notes, and snippets.

View bdlangton's full-sized avatar

Barrett Langton bdlangton

View GitHub Profile
@bdlangton
bdlangton / README.md
Last active June 1, 2022 19:13
Git hooks

Install required packages

Install the packages that you'll need. Drupal/coder includes phpcs. If you're not wanting to use a specific hook, then you don't need to install the associated packages.

composer global require drupal/coder phpmd/phpmd sebastian/phpcpd

Set path

Set the path in your shell startup script (ex: .zshrc or .bashrc).

@bdlangton
bdlangton / Blocks.md
Last active October 12, 2023 08:40
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@bdlangton
bdlangton / tmux.md
Last active May 1, 2024 12:09
Tmux Commands

NOTE: All commands that start with tmux can be executed within a tmux session by typing prefix, followed by :, then type the rest of the command (after tmux).

There is a binary script called tat that can be run and it will create a new session named after the directory that you are currently in. If a session with that name already exists, it will just open that session.

Sessions

Command Description
tmux new -s [session name] Start new named session
prefix s Choose a different session using fzf (custom mapping)