Skip to content

Instantly share code, notes, and snippets.

View liberatr's full-sized avatar

Ryan Price liberatr

View GitHub Profile
@jameswilson
jameswilson / .gitignore
Last active February 28, 2024 01:47
Configure DDEV for AWS CLI, and use an EC2 instance as a jumphost
# Add the following to your project's .gitignore
# The approach here assumes you're going to want to have the awscli also configured
# on your host OS, so we can just copy configs from ~/.aws/ on your host OS into the
# ddev web container during startup by way of the .ddev/homeadditions folder.
.ddev/homeadditions/.aws
@Greg-Boggs
Greg-Boggs / layouts.module.php
Last active November 13, 2022 23:40
layout switcher for Drupal
<?php
function lib_layouts_entity_view_mode_alter(&$view_mode, EntityInterface $entity, $context) {
if ($entity->getEntityTypeId() == 'node' && $entity->bundle() == 'landing_page' && $view_mode == 'full') {
if ($entity->hasField('field_layout')) {
$field = $entity->get('field_layout');
if (!$field->isEmpty()) {
$layout = $entity->get('field_layout')->getString();
$available_modes = \Drupal::service('entity_display.repository')->getViewModes('node');
if (array_key_exists($layout, $available_modes)) {
@mortenson
mortenson / sams_portland_stuff.md
Last active May 7, 2024 17:34
Sam's fun things to do in Portland

Portland recommendations by Sam

Sorted by location-ish. I tried to reduce the list to places I think are good for visitors vs. my absolute favorites, but I put a section at the bottom for places that may not be for everyone.

Breakfast / Brunch

Toki Restaurant (Downtown)

580 SW 12th Ave

My order: Grilled mackerel breakfast with a bloody mary. Their Dalgona coffee is quite good too.

@willvincent
willvincent / db_backup.sh
Last active October 19, 2017 12:59
Intended for use with cron. This script will backup all (or one specific) database, the specified user has access to on the given DB server, and remove backups older than the specified duration to keep them for. If no params are passed, defaults will be used. and backups created for _every_ database.
#!/bin/bash
USAGE="$0 [-u <user> -p <password> -h <host> -P <PORT> -d <database> -D <destination/directory/without/trailing/slash>]"
DESTINATION=`pwd`
USER=root
PASS=root
HOST=localhost
PORT=3306
# SPECIFY HOW LONG TO RETAIN BACKUPS
@typhonius
typhonius / what_should_i_port.pl
Last active March 22, 2016 03:56
Super delicious perl script to get a list of modules from d.o and select one at random for the user to port to Drupal 8. Also it's perlcritic brutal approved!
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::Simple;
use Scalar::Util qw(looks_like_number);
our $VERSION = 1.337;
@EvanAgee
EvanAgee / ContentTypes.feature
Created May 13, 2014 17:47
Example Behat Scenario Outline
Feature: Content Type Tests
As an Administrator
I should be able to create nodes of all Content Types
@api
Background:
Given I am logged in as a user with the "administrator" role
@api @Env::Backend @Creator::EvanAgee
Scenario Outline: Make sure we can create nodes of type <node-type>