Skip to content

Instantly share code, notes, and snippets.

View apperceive's full-sized avatar

Apperceive apperceive

View GitHub Profile
@apperceive
apperceive / drush-experiments1.sh
Last active November 5, 2015 22:23
Some drupal drush commands used as experiments aimed at creating pipes for glup? I dunno. We'll see.
# simple drupal calls via drush
drush @d7Test ev '$a = node_type_get_types(); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
drush @d7Test ev '$a = system_get_info("theme"); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
#unions might be nice?
drush @d7Test ev '$a = system_get_info("module"); while (list($k,$v) = each($a)) {echo "\"$k\",\"$v->name\",\"$v->description\"\n\n";}'
drush @slndev ev '$a = array_keys(system_get_info("theme")); while (list($k,$v) = each($a)) {echo "$k\n";}'
@apperceive
apperceive / gist:dbbd75e39970fcca847b
Created November 7, 2015 15:57
from @iforst - Found this nifty command line to compare the enabled modules between sandboxes
diff -b -s --suppress-common-lines --side-by-side <(drush @XXX pm-list --status=enabled) <(drush @YYY pm-list --status=enabled)
@apperceive
apperceive / _drupal-view-keys.csv
Last active November 8, 2015 03:28
Drupal view keys from a specific view and filtered for arbitrary fields
query
query type
query options
defaults
defaults title
defaults use_more
defaults use_more_always
defaults use_more_text
defaults fields
defaults filter_groups
@apperceive
apperceive / make-index.sh
Created November 11, 2015 08:20
bash command line to iterate over a pattern of folders and create index.html's with name inside
for f in $(find /var/www -maxdepth 2 -type d -regextype awk -regex '.*(dev|test)\.apperceive\.(com|net)' -exec echo {} \;); do echo "Welcome to $f" | sed 's~/var/www/html/~~' > $f/public/index.html; done
@apperceive
apperceive / tw-table-theme.inc
Created November 19, 2015 16:40
add Twitter bootstrap Table Class to Drupal 7 theme table
<?php
function THEMENAME_preprocess_table(&$variables) {
if(!isset($variables['attributes']['class'])) {
$variables['attributes']['class'] = array('table', 'table-striped');
}
else {
$variables['attributes']['class'][] = 'table';
$variables['attributes']['class'][] = 'table-striped';
}
}
@apperceive
apperceive / drupal-theme-table.php
Created November 19, 2015 16:51
Simple Drupal theme_table example
<?php
$colb = array(
'data' => 'b',
'header' => false, // cell is a header
'class' => 'bclass bclass',
'any-td-attr' => 'bvalue',
);
$cella2 = array(
'data' => 'a2',