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 ( isset($_POST['payload']) && $_POST['payload'] ) { | |
echo shell_exec('cd /var/www/mydrupal/ && sudo -u myuser git pull'); | |
echo shell_exec('cd /var/www/mydrupal/sites/all/themes/mytheme/ && sudo -u myuser node ./node_modules/gulp/bin/gulp.js mygulptask'); | |
// Adding the drush will cause the delivery being displayed as unsuccessful. Means GitHub doesn't wait so long. The command will run nevertheless. | |
echo shell_exec('cd /var/www/mydrupal/ && sudo -u myuser drush @sites cc all -y'); | |
} | |
// Should return www-data |
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 | |
namespace Drupal\abc_header\Plugin\Block; | |
use Drupal\Core\Block\BlockBase; | |
/** | |
* Provides a 'ABC Hero Image' Block. | |
* | |
* @Block( |
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
(function ($) { | |
'use strict'; | |
/** | |
* To Title Case 2.1 – http://individed.com/code/to-title-case/ | |
* Copyright © 2008–2013 David Gouch. Licensed under the MIT License. | |
* | |
* @returns {string} | |
*/ | |
String.prototype.toTitleCase = function () { |
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 | |
use Drupal\Core\Render\Element; | |
/** | |
* Implements template_preprocess_field(). | |
* | |
* @param array $variables | |
*/ | |
function MYTHEME_preprocess_field(&$variables) { |
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 | |
/* Automatically set the image Title, Alt-Text, Caption & Description upon upload | |
-----------------------------------------------------------------------*/ | |
add_action('add_attachment', 'my_set_image_meta_upon_image_upload'); | |
function my_set_image_meta_upon_image_upload($post_ID) { | |
// Check if uploaded file is an image, else do nothing |
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
# List containers | |
docker ps | |
# List images | |
docker images | |
# Stop and delete all containers | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) |
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
FROM debian:stretch | |
ENV DEBIAN_FRONTEND noninteractive | |
# install NGINX | |
RUN apt-get update && \ | |
apt-get install -y nginx --no-install-recommends && \ | |
rm -rf /var/lib/apt/lists/* | |
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
# cat /etc/apache2/sites-enabled/000-default.conf | |
<VirtualHost *:80> | |
# The ServerName directive sets the request scheme, hostname and port that | |
# the server uses to identify itself. This is used when creating | |
# redirection URLs. In the context of virtual hosts, the ServerName | |
# specifies what hostname must appear in the request's Host: header to | |
# match this virtual host. For the default virtual host (this file) this | |
# value is not decisive as it is used as a last resort host regardless. | |
# However, you must set it for any further virtual host explicitly. | |
#ServerName www.example.com |
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
version: '2' | |
services: | |
web: | |
image: php:7.0-apache | |
volumes: | |
- /var/www/myapp | |
restart: always | |
bg-sync: |
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
version: '2' | |
services: | |
web: | |
image: php:7.0-apache | |
volumes: | |
- /var/www/myapp | |
bg-sync: |