$ tmux
CTRL+B C -> create new pane
CTRL+B [num] -> go to a pane
CTRL+D -> finish bash session, closes the pane. Closing all panes will destroy the window and thus the tmux
| #!/bin/bash | |
| # Place this file in /usr/local/bin/composer and chmod +x | |
| docker run --rm \ | |
| -u `id -u`:`id -g` \ | |
| --volume "${PWD}":/app \ | |
| --volume "${COMPOSER_HOME:-$HOME/.composer}":/tmp \ | |
| --volume "$SSH_AUTH_SOCK":/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \ | |
| --volume /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts \ |
| ALIAS=@foo | |
| MIGRATION=foo_news | |
| LOG_FILE=/tmp/foo-migrate-logs/migration-foo_news.log | |
| rm -f $LOG_FILE | |
| date > $LOG_FILE | |
| # Run migrations in chunks of 3000 items. | |
| THRESHOLD=3000 | |
| TOTAL=$(COLUMNS=160 drush $ALIAS migrate-status $MIGRATION | tail -n 1 | awk '{print $3}') |
| <?php | |
| use Drupal\Core\Form\FormStateInterface; | |
| function example_ajax_form_alter() { | |
| $ajax_form_request = \Drupal::request()->query->has(FormBuilderInterface::AJAX_FORM_REQUEST); | |
| if ($ajax_form_request) { | |
| if (!$form_state->isProcessingInput()) { | |
| \Drupal::logger('example')->notice('first pass'); | |
| } |
| #!/bin/sh | |
| curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
| COMPOSER_HOME=/opt/drush COMPOSER_BIN_DIR=/usr/local/bin COMPOSER_VENDOR_DIR=/opt/drush composer require drush/drush:7 | |
| cd /opt/drush/drush/drush/ | |
| composer install |
| <?php | |
| function sb_surgery_drush_command() { | |
| $items = array(); | |
| $items['cache-status'] = array( | |
| 'description' => 'Show cache status for each block, view, panel or minipanel', | |
| ); | |
| return $items; | |
| } |
| <?php | |
| // Track # of places sold for an event. The event is addressed by $entity_id and $date. | |
| // $quantity is a positive number of places sold or negative, if places are cancelled. | |
| db_merge('places_sold') | |
| ->key( | |
| array( | |
| 'entity_id' => $entity_id, | |
| 'date' => $date->format(DATE_FORMAT_DATE), | |
| ) |
| ;; Select views using php | |
| SELECT vd.vid, name, id FROM views_display vd LEFT JOIN views_view vv ON vd.vid=vv.vid WHERE display_options LIKE '%php%'; | |
| ;; View php snippets | |
| mysql DBNAME -e "SELECT vd.vid, name, id, display_options FROM views_display vd LEFT JOIN views_view vv ON vd.vid=vv.vid WHERE display_options LIKE '%php%' \G" | less |
| diff --git a/core/rebuild.php b/core/rebuild.php | |
| index c915aff..f26eb6f 100644 | |
| --- a/core/rebuild.php | |
| +++ b/core/rebuild.php | |
| @@ -15,6 +15,9 @@ | |
| use Drupal\Core\Site\Settings; | |
| use Symfony\Component\HttpFoundation\Request; | |
| +use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
| +use Symfony\Component\HttpKernel\KernelEvents; |
| # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*- | |
| # vim: set filetype=sh sw=3 sts=3 expandtab autoindent: | |
| # | |
| # mysql handler script for backupninja | |
| # | |
| getconf backupdir /var/backups/mysql | |
| getconf databases all | |
| getconf ignores | |
| getconf nodata |