Skip to content

Instantly share code, notes, and snippets.

@brockboland
brockboland / local.settings.php
Created January 18, 2012 16:14
My local settings for Drupal sites
<?php
/**
* @file
* local.settings.php
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom:
@brockboland
brockboland / recreate
Created July 2, 2011 06:18
Drupal dev site: recreate template from current site
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: ./recreate drupal_version, for example: ./recreate 6"
else
# Prep a bunch of vars
versionname=d$1
deploydir=~/src/templates/$versionname
sitesdir=$versionname.local
sitesfullpath=~/Sites/$sitesdir
dbname=dev_$versionname
@brockboland
brockboland / deploy
Created July 2, 2011 06:17
Drupal dev site: deploy from template
#!/bin/bash
if [ -z "$1" ]; then
echo "Usage: ./deploy drupal_version, for example: ./deploy 6"
else
versionname=d$1
deploydir=~/src/templates/$versionname
sitesdir=$versionname.local
sitesfullpath=~/Sites/$sitesdir
dbname=dev_$versionname
@brockboland
brockboland / gist:912901
Created April 11, 2011 00:35
Bash function to clone a Drupal module or theme. Add this to your .bash_profile
# Clone a drupal project
function drupalclone {
if [ -z "$1" ]
then
# No parameter passed, show usage
echo "Usage: drupalclone [project_name]"
else
# Clone the project
git clone http://git.drupal.org/project/$1.git
fi
@brockboland
brockboland / gist:790842
Created January 22, 2011 03:59
A basic example of adding a file upload field to a Drupal form
<?php
/**
* Implements hook_form_alter().
*/
function filetest_form_alter(&$form, &$form_state, $form_id) {
switch ($form_id) {
case 'contact_mail_page':
// Need to set the enctype so the form will allow file uploads
$form['#attributes']['enctype'] = "multipart/form-data";
$form['new_file'] = array(
@brockboland
brockboland / starter.make
Created May 18, 2010 02:28
Basic Drush Make starter file
; Basic Drush Make file
; See the Drush Make prject page for info:
; http://drupal.org/project/drush_make
; This file by Brock Boland [[email protected]]
;
; This file is also on GitHub:
; http://gist.github.com/404528
; Core version
; ------------