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
#!/bin/bash | |
# Check arguments and requirements. | |
if [ ${#@} -lt 1 ]; then | |
echo "This script expects one argument (site machine name)." | |
exit 1 | |
fi | |
if [ -x ${HOME}/.my.cnf ]; then | |
echo "This script requires ${HOME}/.my.cnf." |
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 | |
foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $call) { | |
watchdog('backtrace', $call['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 | |
/** | |
* Implements hook_theme(). | |
*/ | |
function EXAMPLE_theme() { | |
$path = drupal_get_path('module', 'EXAMPLE'); | |
$hooks = array( | |
'iu_license' => array( | |
'template' => 'iu-license', |
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
# -*- 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 |
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
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; |
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
;; 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 |
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 | |
// 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), | |
) |
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 | |
function sb_surgery_drush_command() { | |
$items = array(); | |
$items['cache-status'] = array( | |
'description' => 'Show cache status for each block, view, panel or minipanel', | |
); | |
return $items; | |
} |
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
#!/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 |
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\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'); | |
} |