This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_preprocess_HOOK(). | |
* | |
* @note: This can be removed if https://www.drupal.org/project/drupal/issues/2870054 is fixed. | |
*/ | |
function MODULE_preprocess_menu(&$variables) { | |
/** @var Drupal\Core\Routing\CurrentRouteMatch */ | |
$routeMatcher = \Drupal::routeMatch(); | |
/** @var Drupal\Core\Routing\RouteMatch */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @file | |
* Deployment script for composer-based Drupal 8 installations using Deployer. | |
*/ | |
namespace Deployer; | |
use Deployer\Support\Unix; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { | |
/** | |
* Adds the current template info for debugging. | |
* | |
* @param string $t The template. | |
*/ | |
function var_template_include( $t ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$iterator = new RecursiveIteratorIterator( | |
new RecursiveArrayIterator($multidimensional_array, RecursiveArrayIterator::CHILD_ARRAYS_ONLY), | |
RecursiveIteratorIterator::SELF_FIRST | |
); | |
foreach ($iterator as $key => $value) { | |
if ($key === $search) { | |
$your_data = $value; | |
break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: example | |
recipe: drupal8 | |
config: | |
webroot: web | |
xdebug: true | |
tooling: | |
drush: | |
service: appserver | |
cmd: | |
- "drush" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This Dockerfile is aimed at building it from a directory containing a Gemfile. | |
# It installs the Gemfile packages and then gives you the "bundle exec" entry point. | |
# | |
# Usage: | |
# * docker build --tag=bundle-exec . | |
# * docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/src bundle-exec | |
# Example: docker run -it --rm --user $(id -u):$(id -g) -v $(pwd):/src bundle-exec compass compile -e production | |
FROM ubuntu:16.04 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Force HTTPS and canonical host. | |
*/ | |
if (php_sapi_name() != 'cli') { | |
$primary_domain = 'www.example.com'; | |
if ($_SERVER['HTTP_HOST'] != $primary_domain || !array_key_exists('HTTPS', $_SERVER)) { | |
header('HTTP/1.0 301 Moved Permanently'); | |
header('Location: https://'. $primary_domain . $_SERVER['REQUEST_URI']); | |
exit(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Basically packs all the instructions in https://github.com/Neilpang/acme.sh/wiki/Simple-guide-to-add-TLS-cert-to-cpanel | |
# into a single command, while adding all the default cPanel subdomains. If this is useful to you, consider donating to | |
# the acme.sh creator here: https://donate.acme.sh/. | |
### Change the following variables with your info. | |
EMAIL="[email protected]" | |
DOMAIN="example.com" | |
WEBROOT="${HOME}/public_html/" # Trailing slash required! |