Skip to content

Instantly share code, notes, and snippets.

@Greg-Boggs
Greg-Boggs / module.php
Created September 15, 2021 23:07
Save the fields from the previous node to the new node when they have the same title and presenter
<?php
/**
* Implements hook_ENTITY_TYPE_presave().
*
* Prefill cost information for events if a previous event matches the same name and presenter.
*/
function libevents_node_presave(EntityInterface $node) {
$title = '';
$presenter = '';
name: PHP Composer
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
@Greg-Boggs
Greg-Boggs / gist:1529d9e977703500bda11f35016b1e4d
Created August 17, 2021 20:17
Sample Github actions for a Drupal 9 site.
name: PHP Composer
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
tests:
@Greg-Boggs
Greg-Boggs / defaul.vcl
Created June 28, 2021 19:17
Fastly VCL example
pragma optional_param geoip_opt_in true;
pragma optional_param max_object_size 20971520;
pragma optional_param smiss_max_object_size 20971520;
pragma optional_param fetchless_purge_all 1;
pragma optional_param default_ssl_check_cert 1;
pragma optional_param max_backends 5;
pragma optional_param customer_id "69tE1aWeLLcC9NVLbklz7g";
C!
W!
# Backends
@Greg-Boggs
Greg-Boggs / ridwell waste.html
Last active June 25, 2021 00:13
Where does Ridwell send Waste in Portland (6/24/21)?
The website didn't really say where our trash ends up. So, I asked them via email where the trash from Portland Oregon goes.
#!/bin/bash
#set -e
cd ~
xcode-select --install
# install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
#composer

Day 1

Chest

3 x 25 pushups (Used to do bench press, but that hurt my shoulder, so I stopped doing them I'd probably use a machine for these if I had a gym.)

3 x 6-12 dumbbell flies on the floor (I'd probably also do these on a machine )

3 x 8-12 standing low dumbbell chest fly (I'd use a cable for these if I had one and I would throw in some dips if I had bars)

@Greg-Boggs
Greg-Boggs / settings.php
Last active June 21, 2021 18:05
settings.php on platform.sh
<?php
// ... default drupal 9 stuff...
// Include automatic Platform.sh settings.
if (file_exists(__DIR__ . '/settings.platformsh.php')) {
require_once(__DIR__ . '/settings.platformsh.php');
}
// Include local settings. These come last so that they can override anything.
$on_platformsh = !empty($_ENV['PLATFORM_PROJECT']);
@Greg-Boggs
Greg-Boggs / wordpress.vcl
Last active June 19, 2021 01:31 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples.
@Greg-Boggs
Greg-Boggs / route.php
Last active May 12, 2021 19:19
How to print a platformsh route for your environment in PHP
<?php
$projectId = getenv('PLATFORM_PROJECT');
// A JSON-encoded value.
$projectId = getenv('PLATFORM_PROJECT');
// A JSON-encoded value.
$routes = json_decode(base64_decode(getenv('PLATFORM_ROUTES')), TRUE);