Skip to content

Instantly share code, notes, and snippets.

View chrisfromredfin's full-sized avatar

Chris Wells chrisfromredfin

View GitHub Profile
@chrisfromredfin
chrisfromredfin / pb-reset
Created November 27, 2024 15:15
DDEV host command to reset and re-install project browser
#!/bin/bash
## Description: Re-install Project Browser from scratch
## Usage: pb-reset
## Aliases: pbr
## Example: ddev pbr\nddev pb-reset
# Fail on any error
set -e
@chrisfromredfin
chrisfromredfin / switch
Created November 27, 2024 15:14
DDEV command to "switch" to a new issue fork
#!/bin/bash
## Description: Switch to a new issue fork and branch
## Usage: switch [args]
## Example: ddev switch branch-name 123456\nddev switch 123456-branch-name
# Fail on any error
set -e
# Check if the current directory is a git repository
@chrisfromredfin
chrisfromredfin / example.drupalpod.yaml
Last active May 17, 2023 16:47
An example of a drupalpod.yaml file that could be included with a Contrib module.
# Each of these is a "profile" which can be enabled. Each profile is a set of
# settings for your install that DrupalPod can configure for you. You MUST have
# at least a "default" key in this file, or it will be discarded entirely (default
# is the profile used if an alternative is not specified in the URL, in DP_EXTRA_SETTINGS).
default:
# extra_packages: specifies additional composer packages to install. Use composer
# constraint syntax
extra_packages:
- drupal/automatic_updates:^3
Content
Third-party Integration
Utility
Content Display
Administration
Developer
Fields
E-commerce
Media
Commerce/Advertising
<?php
define('START', 0);
define('END', 948);
$output_handle = fopen('./projects.csv', 'w');
fputcsv($output_handle, [
'category',
'development status',
'maintained',
'body',
@chrisfromredfin
chrisfromredfin / NotNodeType.php
Created November 18, 2020 19:47
A "not node type" condition plugin
<?php
namespace Drupal\YOURMODULE\Plugin\Condition;
use Drupal\node\Plugin\Condition\NodeType;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\node\NodeInterface;
/**
* Provides a 'Not Node Type' condition.
{% macro buttonset(items) %}
<ul class="buttonset">
{% for item in items %}
<li><a class="button" title="{{ item.name }}">{{ item.label }}</a></li>
{% endfor %}
</ul>
{% endmacro %}
/// @name buttonset
/// @example njk
/// {% import 'buttonset.macro.njk' as mymacro %}
/// {{ mymacro.buttonset([{"name": "do something", "label": "open"}, {"name": "do something else", "label": "close"}]) }}
{% block content %}
<ul class="buttonset">
{% for item in items %}
<li><a class="button" title="{{ item.name }}">{{ item.label }}</a></li>
{% endfor %}
</ul>
{% endblock %}
/// @group components
/// @name buttonset
/// @example njk
/// {% set items = [{"name": "do something", "label": "open"}, {"name": "do something else", "label": "close"}] %}
/// {% include 'buttonlist.njk' %}
///
.buttonset {
li {
display: inline-block;
list-style-type: none;