Skip to content

Instantly share code, notes, and snippets.

View apperceive's full-sized avatar

Apperceive apperceive

View GitHub Profile
@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',
@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 / 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 / _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 / 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 / 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 / usa-power-grab-timeline-riki-ott.tsv
Last active November 2, 2015 01:06
CSV version of Riki Ott's US Power Grab Timeline data
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 10 columns, instead of 4 in line 4.
Start Date End Date Headline Text Media Media Credit Media Caption Media Thumbnail Type Tag
2/23/2013 Corporate Rights and Power Historical Timeline From the Ultimate Civics 'Organizing for Change' manual and the 'Rethinking Democracy' high school curriculum. Video posted by FluxRostrum <a href='http://www.youtube.com/watch?feature=player_embedded&v=OkUw99XJkfI' title='Corporate Power Grab Historical Timeline , on Youtube'>Corporate Power Grab Historical Timeline </a> title
1/1/1776 Revolutionary War begins
1/1/1789 *The US Constitution The writers of the Constitution were very interested in protecting their property. Without using the words “slave” or “slavery,” they made slavery legal and institutionalized it. “No person held in Service or Labour in one State,… escaping into another, shall… be discharged from such Service or Labour, but shall be delivered up on Claim of the Party to whom such Service or Labour may be due.” [Art. 4, Sec. 2]
1/1/1791 *Bill of Rights The first 10 Amendmen
@apperceive
apperceive / usa-power-grab-timeline-riki-ott.csv
Last active November 2, 2015 01:03
CSV version of Riki Ott's US Power Grab Timeline data
We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 5.
Start Date,End Date,Headline,Text,Media,Media Credit,Media Caption,Media Thumbnail,Type,Tag
2/23/2013,,Corporate Rights and Power Historical Timeline ,"From the Ultimate Civics 'Organizing for Change' manual and the 'Rethinking Democracy' high school curriculum.",,Video posted by FluxRostrum,"<a href=""http://www.youtube.com/watch?feature=player_embedded&v=OkUw99XJkfI"" title='Corporate Power Grab Historical Timeline , on Youtube'>Corporate Power Grab Historical Timeline </a>",,title,
1/1/1776,,Revolutionary War begins,,,,,,,
1/1/1789,,*The US Constitution,"The writers of the Constitution were very interested in protecting their property. Without using the words 'slave' or 'slavery', they made slavery legal and institutionalized it. 'No person held in Service or Labour in one State,… escaping into another, shall… be discharged from such Service or Labour, but shall be delivered up on Claim of the Party to whom such Service or Labour may be due.' [Art. 4, Sec. 2]",,,,,,
1/1/1791,,*Bill of Rights,"The first 10
@apperceive
apperceive / db-table-last-access.sql
Last active October 22, 2015 13:34
Show mySQL database table last access dates
SELECT update_time, table_name FROM information_schema.tables WHERE table_schema = 'MYDB' ORDER BY 1,2;
@apperceive
apperceive / ia-urls.md
Last active November 12, 2015 15:56
My archive.org reading list