Skip to content

Instantly share code, notes, and snippets.

View ohthehugemanatee's full-sized avatar
💭
I may be slow to respond.

Campbell Vertesi ohthehugemanatee

💭
I may be slow to respond.
View GitHub Profile
@ohthehugemanatee
ohthehugemanatee / keycdn.php
Last active May 14, 2017 13:47
how I invalidated keycdn
<?php
// Invalidate and update the item state.
$hashes = KeycdnCacheTagHeaderGenerator::cacheTagsToHashes($tags);
// Break the list of tags into multiple requests.
$hash_sets = array_chunk($hashes, 1000);
foreach ($hash_sets as $hash_set) {
$invalidation_state = $this->invalidateItems('tags', $hash_set);
}
Array
(
[json] => Array
(
[tags] => Array
(
[0] => b82
[1] => 0e7
[2] => dbc
[3] => 633
@ohthehugemanatee
ohthehugemanatee / update-xdebug-hostname.sh
Created September 20, 2016 08:22
Updates the xdebug hostname to "dockerhost", which is set to the host system's IP. This one actually requires "docker-compose restart", the service restart isn't enough.
#!/bin/bash
# To be run from inside the docker container. This script updates PHP settings to use the 'dockerhost' hostname
# rather than auto-discovery.
# The dockerhost hostname only works when your host machine has it's IP address in a variable called DOCKERHOST
# Fix host settings for web-based xdebug
sudo sed -i '/remote_connect_back/d' /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_flag[xdebug.remote_connect_back] = off' >> /etc/php/fpm-pool/drupal-xdebug.conf
sudo echo 'php_admin_value[xdebug.remote_host] = "dockerhost"' >> /etc/php/fpm-pool/drupal-xdebug.conf
@ohthehugemanatee
ohthehugemanatee / enable-cli-xdebug.sh
Created September 20, 2016 08:20
once xdebug is working globally, we can enable it for the CLI. Note the alias 'xdebug-on'. Ideally there should be an xdebug-off, too...
#!/bin/bash
# Enable CLI xdebug when the IDEkey is available in environment.
# Run this script on the GUEST machine with `docker-compose exec drupal /var/www/drupal/public_html/enable-cli-xdebug.sh`
# use it with 'export XDEBUG_CONFIG="idekey=foobar"'
# Note: PHPStorm also requires 'export PHP_IDE_CONFIG="serverName=popo.docker.amazee.io"'
sudo rm /etc/php/7.0/cli/conf.d/20-xdebug.ini
sudo echo 'zend_extension=xdebug.so' > /etc/php/7.0/cli/conf.d/20-xdebug.ini
sudo echo 'xdebug.remote_enable = on' >> /etc/php/7.0/cli/conf.d/20-xdebug.ini
if grep --quiet dockerhost /etc/php/fpm-pool/drupal-xdebug.conf; then