Skip to content

Instantly share code, notes, and snippets.

@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
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

<?php
/**
* This plugin creates a new paragraph entity based on the source.
*
* @MigrateProcessPlugin(
* id = "mds_paragraph"
* )
*/
class ParagraphMigrateProcessor extends ParagraphProcessBase {
@nikathone
nikathone / UserResetLoginSubscriber.php
Created February 14, 2017 20:32
User reset login subscriber and redirect alter example.
<?php
namespace Drupal\wh_signup\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
@jesugmz
jesugmz / Dockerfile
Last active October 23, 2021 21:25
Example how to build Docker multi-stage image using official PHP and Composer images
ARG PHP_VERSION=7.2-fpm-stretch
ARG COMPOSER_VERSION=latest
# builder stage
FROM php:$PHP_VERSION AS builder
ARG AMQP_VERSION=1.9.3
ARG PHPREDIS_VERSION=4.1.1
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \
@tpiros
tpiros / robbyrussell.zsh-theme
Created November 1, 2019 10:39
Adding emojis to ZSH theme
# On a Mac: /Users/<username>/.oh-my-zsh/custom/themes
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
local emojis=("👋" "🤡" "🦄" "🤙" "🐼" "😊" "🔥" "⚡" "😎" "🌎")
local selectedEmoji=${emojis[$[1+($RANDOM%${#emojis[@]})]]}
local today=$(date +%m.%d)
# local ipCountry=`curl -s ip-api.com/json | python -c "import sys, json; print json.load(sys.stdin)['country']"`
# local country=$emoji_flags[${ipCountry}]
# }
case $today in
"01.01")
@PierreThiollent
PierreThiollent / Readme.md
Last active March 26, 2024 19:14
iTerm2 and Oh-my-zsh config

Setup iTerm2 and oh-my-zsh

Enjoy ! 😄

Install iTerm 2

Download iTerm2 here.

@mortenson
mortenson / ddrush.sh
Last active March 20, 2022 09:51
What I currently use for local Drupal/Tome dev
#! /bin/bash
# This runs a new Docker container, mounts the current directory (Drupal root),
# and runs an arbitrary drush command, in case you don't want to run it in dsession.
sudo docker run --rm -it --init -v "$(pwd)":/var/www/tome mortenson/tome drush "$@"
@duffney
duffney / becomeansible-2-10-dockerfile.md
Last active October 23, 2020 02:30
Dockerfile and supporting links for Ansible 2.10 for become Ansible

Dockerfile

FROM centos:centos7
COPY requirements-azure /tmp
RUN yum check-update; \
yum install -y gcc libffi-devel python3 epel-release; \
yum install -y openssh-clients; \
curl https://packages.microsoft.com/config/rhel/7/prod.repo | tee /etc/yum.repos.d/microsoft.repo; \
yum install -y powershell; \
@socketwench
socketwench / yourtheme.theme
Created November 9, 2020 04:37
Drupal 8: Add view_mode to block templates, add view mode to template suggestions.
/**
* Implements hook_preprocess_HOOK().
*/
function yourtheme_preprocess_block(&$variables) {
$content = $variables['elements']['content'];
if (isset($content['#block_content']) && $content['#block_content'] instanceof BlockContentInterface) {
$variables['view_mode'] = $content['#view_mode'];
}
}
# Completely flush redis, old stuff is no longer relevant and wastes space, avoids any
# old state to influence update functions.
./vendor/bin/drush ev "\Drupal::service('redis.factory')->getClient()->flushAll()"
# Check if there are any updates to run.
if [ -n "$(./vendor/bin/drush updbst --format=list 2>/dev/null)" ]; then
# If so, then drush updb includes a drush cr, but separately clear css/js cache
# because due to memory cache backend during updates, it does not invalidate things properly.
./vendor/bin/drush updb -y
./vendor/bin/drush cc css-js
else