Skip to content

Instantly share code, notes, and snippets.

@szeidler
szeidler / docker-cleanup-resources.md
Created July 18, 2017 15:05 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@szeidler
szeidler / services-add_item_id_attribute-1653592.patch
Created June 30, 2017 14:16
Add support for index values on xml output. Otherwise you will lose information about numeric array keys.
diff --git a/servers/rest_server/includes/ServicesFormatter.inc b/servers/rest_server/includes/ServicesFormatter.inc
index 9799b19..8ce275a 100644
--- a/servers/rest_server/includes/ServicesFormatter.inc
+++ b/servers/rest_server/includes/ServicesFormatter.inc
@@ -61,6 +61,7 @@ class ServicesXMLFormatter implements ServicesFormatterInterface {
$assoc = FALSE || empty($data);
foreach ($data as $key => $value) {
if (is_numeric($key)) {
+ $id = $key;
$key = 'item';
@szeidler
szeidler / drushrc.php
Created May 19, 2017 11:44
drushrc.php for Drush Patchfile and Docker4Drupal
<?php
// Get the site absolute filepath. Extracted from drush_site_path().
function drush_get_absolute_site_path() {
$possible_paths = array(
'/var/www/drupal/web/sites/default',
'/var/www/html/web/sites/default',
'/var/www/html/sites/default',
);
@szeidler
szeidler / ddrupal.sh
Created May 19, 2017 11:12
Use Drupal console with docker4drupal
#!/bin/sh
docker-compose exec --user 82 php drupal
#alias ddrupal = docker-compose exec --user 82 php drupal
#!/bin/sh
# Usage: sudo curl https://gist.githubusercontent.com/szeidler/0b0e166b0e34dbb01248680627470af1/raw/setup-docker4drupal-mac-environment.sh | sh
# Check if docker is setup.
if ! [ -x "$(command -v docker-compose)" ]; then
echo 'Make sure, that you have installed Docker4Mac: https://download.docker.com/mac/stable/Docker.dmg'
exit 1
fi
# Install unison for Mac
@szeidler
szeidler / drupal7-nginx-with-fotoweb.conf
Last active July 11, 2017 18:08
Nginx configuration for Fotoweb image style processing
server {
server_name SERVER_NAME;
listen 80;
root /var/www/html/;
index index.php;
fastcgi_keep_conn on;
fastcgi_index index.php;
fastcgi_param QUERY_STRING $query_string;
@szeidler
szeidler / manualcrop-make_selection_path_alterable.patch
Created March 14, 2017 17:56
Fotoweb: Alter the file path for manualcrop selection. That is needed, because manualcrop settings are stored for $file->uri not image style path.
diff --git a/manualcrop.helpers.inc b/manualcrop.helpers.inc
index 1375f99..090cca0 100644
--- a/manualcrop.helpers.inc
+++ b/manualcrop.helpers.inc
@@ -636,6 +636,8 @@ function manualcrop_save_crop_data($file, $data) {
* - "height": An integer representing the height in pixels.
*/
function manualcrop_load_crop_selection($file, $style_name = NULL) {
+ drupal_alter('manualcrop_load_crop_selection', $file);
+
@szeidler
szeidler / Mysql Commands
Created March 6, 2017 16:31
MySQL: Create User and grant priv to wildcard DB
.
@szeidler
szeidler / drush-sql-dump.sh
Created March 3, 2017 12:02
drush sql-dump
drush sql-dump --structure-tables-list=ctools_object_cache,ctools_css_cache,cache,cache_field,cache_form,cache_filter,cache_menu,cache_page,cache_views,cache_views_data,history,sessions,watchdog > ~/backup/database/backup-20170303.sql
@szeidler
szeidler / gulpfile.js
Created February 23, 2017 10:16
Gulp files for Drupal theming (including clever drush cache clearing)
/**
* Gulp file for Drupal theming, including clever drush cache clearing.
*
* Usage in docker4drupal environment: `gulp --docker`
* It ensures, that drush is executed from the php container.
*/
var gulp = require('gulp');
var argv = require('yargs').argv;
var plumber = require('gulp-plumber');