Skip to content

Instantly share code, notes, and snippets.

View briward's full-sized avatar
🐕‍🦺

Bri Ward briward

🐕‍🦺
View GitHub Profile
@briward
briward / PHP
Created October 11, 2018 11:05
$config['language.types']['negotiation'] = [
'language_interface' => [
'method_weights' => [
'language-user-admin' => -19,
'language-url' => -18,
'language-session' => -17,
'language-user' => -16,
'language-browser' => -15,
'language-selected' => -14,
'language-astra-site' => -20
<?php
function oa_core_visibility_data($node) {
$static = &drupal_static(__FUNCTION__, array());
if (!empty($static[$node->nid])) {
return $static[$node->nid];
}
$data = array();
$data['published'] = !empty($node->status);
$data['archived'] = FALSE;
@briward
briward / Term.php
Last active August 21, 2018 14:23
Taxonomy Term Vocabulary Exists Validation
/**
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
$fields = parent::baseFieldDefinitions($entity_type);
$fields['tid']->setLabel(t('Term ID'))
->setDescription(t('The term ID.'));
@briward
briward / ADR
Last active October 16, 2019 16:21
Starter architectural decisions document.
Use of ADRs to track Architectural Decisions
============================================
Context
-------
At the moment architectural decisions are being made when required and they
are not recorded.
Decision
FROM quay.io/continuouspipe/php5.6-apache:latest
MAINTAINER Brian Ward <bward@inviqa.com>
# Install base packages \
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get -yq install \
php-gd \
php-xml \
php-json \
@briward
briward / index.php
Last active February 11, 2016 13:56
<?php
require __DIR__ . '/vendor/autoload.php';
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
$container = new \Slim\Container;
// Register the Flysystem service.
<?php
require __DIR__ . '/vendor/autoload.php';
use League\Flysystem\Filesystem;
use League\Flysystem\Adapter\Local;
$app = new Slim\App();
// Routes
composer require league/flysystem
@briward
briward / index.php
Last active February 11, 2016 14:17
<?php
require __DIR__ . '/vendor/autoload.php';
$app = new Slim\App();
// Routes
$app->get('/', function($request, $response, $args) {
return $response->getBody()->write('Welcome to the application.');
});
php -S localhost:4000