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 / gist:3757854
Created September 20, 2012 19:28 — forked from lornajane/gist:3756788
My First Form
<form method="post">
Name: <input type="text" name="name" />
<br />
<input type="submit" />
</form>
<?
if($_POST) {
echo "Hello, " . filter_input(INPUT_POST, "name", FILTER_SANITIZE_STRING);
@jbickar
jbickar / gist:758e1ac2e56fd93b5b14
Created August 29, 2014 17:56
Insert stanford profile to DB
insert into system (filename, name, type, owner, status, bootstrap, schema_version, weight, info) values ('profiles/stanford/stanford.profile', 'stanford', 'module', '', 1, 0, 0, 1000, 'a:12:{s:4:"name";s:14:"Stanford Sites";s:11:"description";s:94:"Select this profile to install a version of Drupal customized for the Stanford Sites platform.";s:4:"core";s:3:"7.x";s:7:"version";s:13:"7.x-1.1-beta4";s:12:"dependencies";a:49:{i:0;s:13:"advanced_help";i:1;s:14:"auto_nodetitle";i:2;s:10:"admin_menu";i:3;s:18:"admin_menu_toolbar";i:4;s:11:"admin_views";i:5;s:5:"block";i:6;s:5:"color";i:7;s:7:"comment";i:8;s:10:"contextual";i:9;s:12:"css_injector";i:10;s:4:"date";i:11;s:8:"date_api";i:12;s:9:"dashboard";i:13;s:5:"dblog";i:14;s:5:"email";i:15;s:8:"features";i:16;s:5:"field";i:17;s:8:"field_ui";i:18;s:4:"file";i:19;s:5:"image";i:20;s:14:"globalredirect";i:21;s:4:"help";i:22;s:5:"image";i:23;s:6:"insert";i:24;s:9:"libraries";i:25;s:4:"link";i:26;s:4:"list";i:27;s:4:"menu";i:28;s:13:"module_filter";i:29;s:12:"nodeformc
@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' "{}" \;
@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: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 / 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'] = 'noreply@example.com';
@jbickar
jbickar / config
Created October 16, 2015 20:06
SSH config (~/.ssh/config)
Host *.stanford.edu
GSSAPIDelegateCredentials yes
GSSAPIAuthentication yes
GSSAPIKeyExchange no
@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 '.'...
#!/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 / 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