Skip to content

Instantly share code, notes, and snippets.

@simesy
simesy / deploy-not-tested.sh
Created November 30, 2017 00:15
Deploy to acquia with robo-git-artefact
#!/usr/bin/env bash
# An un-abstracted example of deploying to Acquia's git.
# Assumes your project lives in github or something and you want to
# deploy code to Acquia.
#
# Assumes you have a ~/.acquia/cloudapi.conf etc. In other words, if you can
# `git clone` the Acquia repo, and push to it, and run drush commands on
# the Acquia site, then this script will work.
<?php
namespace Drupal\acme_jsonapi\Plugin\jsonapi\FieldEnhancer;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerBase;
use Shaper\Util\Context;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Url;
@simesy
simesy / JsonapiData.php
Last active May 14, 2018 23:19
Offers a new "JSON Data" field when you "Add fields" in the Drupal search_api interface. If you set the field to "Full text" it will be searchable.
<?php
namespace Drupal\PROJECT\Plugin\search_api\processor;
use Drupal\search_api\Datasource\DatasourceInterface;
use Drupal\search_api\Item\ItemInterface;
use Drupal\search_api\Processor\ProcessorPluginBase;
use Drupal\search_api\Processor\ProcessorProperty;
/**
@simesy
simesy / EntityType.php
Created May 15, 2018 21:16
Search api processor plugin to add entity type as an indexed field.
<?php
namespace Drupal\PROJECT\Plugin\search_api\processor;
use Drupal\search_api\Datasource\DatasourceInterface;
use Drupal\search_api\Item\ItemInterface;
use Drupal\search_api\Processor\ProcessorPluginBase;
use Drupal\search_api\Processor\ProcessorProperty;
/**
@simesy
simesy / AliasedLinkEnhancer.php
Created June 6, 2018 10:30
Rosolve internal links - change MYMODULE and put in src/Plugin/jsonapi/FieldEnhancer
<?php
namespace Drupal\MYMODULE\Plugin\jsonapi\FieldEnhancer;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerBase;
use Shaper\Util\Context;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Url;
@simesy
simesy / gist:f667eab8eb180bc5bbeb319c4a7930ea
Created August 26, 2018 12:18
Debugging some proxy things
<?php
print "\n\nSERVER HEADERS:\n\n";
print(var_export($_SERVER, TRUE));
print "\n\nSymfony HTTP Foundation request headers:\n\n";
$request = \Drupal::request();
foreach ($request->headers->all() as $key => $header) {
print $key . ': ' . $header[0] . "\n";
}
#!/usr/bin/env bash
# Pushed into the container by .lando.yml
alias phpunit=/app/vendor/bin/phpunit
@simesy
simesy / README.txt
Last active April 24, 2019 04:13
Drupal 8 - Example settings.php setup
See https://lilengine.co/articles/example-settings-php-drupal-8
File structure in sites/default/...
- settings.php
- includes/
--- default.settings.php
--- default.services.yml
--- lando.settings.php
--- lando.services.yml
@simesy
simesy / nofile.txt
Last active April 20, 2025 05:44
GovCMS dev tooling check
# You can copy/paste this command into your terminal.
echo "Check your GovCMS developer tools:" \
&& git --version \
&& docker --version \
&& docker-compose --version \
&& pygmy --version \
&& echo "Ahoy "$(ahoy --version)
@simesy
simesy / docker-compose.override.yml
Created November 13, 2019 06:15
Mount custom/modules for local development.
version: '2.3'
services:
cli:
volumes:
- ./custom/modules:/app/web/sites/default/modules/local:${VOLUME_FLAGS:-delegated}
test:
volumes:
- ./custom/modules:/app/web/sites/default/modules/local:${VOLUME_FLAGS:-delegated}