Skip to content

Instantly share code, notes, and snippets.

View jbickar's full-sized avatar

John Bickar jbickar

  • Stanford University
View GitHub Profile
@jbickar
jbickar / field_collection_patch_fail
Created April 15, 2016 23:30
Field Collection Patch Fail
* [@self.38 ] field_collection-7.x-1.0-beta11 downloaded. [175.03 sec, 7.57 MB] [ok]
* [@self.38 ] https---www.drupal.org-files-issues-field_collection-2385985-29.patch retrieved from cache. [175.03 sec, 7.54 MB] [notice]
* [@self.38 ] Checking patch field_collection.module... [notice]
Applied patch field_collection.module cleanly. [175.05 sec, 7.54 MB]
* [@self.38 ] field_collection patched with field_collection-2385985-29.patch. [175.05 sec, 7.54 MB] [ok]
* [@self.38 ] https---www.drupal.org-files-i
@jbickar
jbickar / convert.drush.inc
Created December 2, 2015 21:31
drush plugin to convert MySQL table engine
<?php
/**
* Implements hook_drush_command().
*/
function convert_drush_command() {
$items = array();
// the key in the $items array is the name of the command.
$items['convert-engine'] = array(
// a short description of your command
@jbickar
jbickar / DevStandards.MD
Last active November 12, 2015 23:03 — forked from sherakama/DevStandards.MD
Stanford Web Services Drupal Development Standards

Drupal Development Standards

by Stanford Web Services
Version: 1.0.0
Date: October 30, 2015

This document is meant to be a comprehensive guide to web development standards for Stanford Web Services around Drupal web development. This document is our canonical source and guide.

Code Standards

#!/bin/bash
# TODO Grunt this.
## If dir exists empty it.
if [ -d /Users/jbickar/Sites/$1 ]; then
cd /Users/jbickar/Sites/$1
drush sql-drop -y
cd ../
rm -Rf /Users/jbickar/Sites/$1
@jbickar
jbickar / aliases.drushrc.php
Last active October 16, 2015 20:26
Drush aliases file
<?php
## STANFORD WILDCARD #######################################################
// The command you just typed in shell.
$command = $_SERVER['argv'];
// Look at every argument...
foreach ($command as $arg){
// There aren't many cases where there are '.'...
@jbickar
jbickar / config
Created October 16, 2015 20:06
SSH config (~/.ssh/config)
Host *.stanford.edu
GSSAPIDelegateCredentials yes
GSSAPIAuthentication yes
GSSAPIKeyExchange no
@jbickar
jbickar / gist:dad74f7578c003fb9239
Created July 8, 2015 15:02
hook_mail_alter() implementation
/**
* Implements hook_mail_alter().
*/
function mymodule_mail_alter(&$message) {
if (($message['id'] == 'contact_page_mail') || ($message['id'] == 'contact_user_mail')) {
$message['headers']['Reply-To'] = $message['from'];
$message['body'][2] = $message['body'][1];
$message['body'][1] = 'Reply to this message using: '.$message['from'];
$message['from'] = '[email protected]';
@jbickar
jbickar / gist:0be651562a77215c97dc
Last active August 29, 2015 14:23
DS Search Results

Overriding Search Results with Display Suite

Bug with ds-7.x-2.10: https://www.drupal.org/node/2490932

  1. Enable ds_ui and ds_search
  2. Go to admin/config/search/settings and enable Display Suite Search (under "Active Search Modules") and set it as the "default search module". Disable "Node" under "Active Search Modules".
  3. Go to admin/structure/ds/list/search and configure your desired DS Search settings. Choose the "Search result highlighting input" View mode (this is the default)
  4. Go to admin/structure/types/manage/<nodetype>/display and click the "Custom display settings" vertical tab. Check the box for "Search result highlighting input"
  5. Go to admin/structure/types/manage/<nodetype>/display/search_result and click the "Layout for in search result" vertical tab. Choose "One column" from "Select a layout" and click Save.
  6. Still on admin/structure/types/manage//display/search_result, choose the fields that you want to display in the search result (e.g., "Title"
@jbickar
jbickar / su-clone.sh
Last active August 29, 2015 14:16 — forked from sherakama/su-clone.sh
#!/bin/bash
## If dir exists empty it.
if [ -d /Applications/MAMP/htdocs/$1 ]; then
cd /Applications/MAMP/htdocs/$1
drush sql-drop -y
cd ../
rm -Rf /Applications/MAMP/htdocs/$1
fi
@jbickar
jbickar / gist:03d2b5ac45b421024aed
Created February 10, 2015 21:19
Use find and sed to update all version numbers within a directory
find . -name "*.info" -exec sed -i '' 's/version\ \=\ 7.x-2.2/version\ \=\ 7.x-2.3/g' "{}" \;