Skip to content

Instantly share code, notes, and snippets.

@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
; ------------
@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 / 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 / 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 / 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 / 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 / gist:1658632
Created January 22, 2012 20:19
TextExpander snippet to load https://gist.github.com/1633790
#!/usr/bin/php
<?php
// Make sure to set the Content dropdown to Shell Script in TextExpander
print file_get_contents('https://raw.github.com/gist/1633790/local.settings.php');
diff --git a/feeds_xpathparser.module b/feeds_xpathparser.module
index bb583ed..aca2470 100644 (file)
--- a/feeds_xpathparser.module
+++ b/feeds_xpathparser.module
@@ -10,7 +10,8 @@ function feeds_xpathparser_feeds_plugins() {
'description' => t('Parse HTML using XPath.'),
'handler' => array(
'parent' => 'FeedsParser',
@brockboland
brockboland / gist:3094686
Created July 12, 2012 00:27
Simple "Tweet this page" bookmarklet Javascript
javascript: var D=550, A=450, C=screen.height, B=screen.width, H=Math.round((B/2)-(D/2)), G=0, F=document, t=encodeURIComponent(F.title), u=encodeURIComponent(F.location); if(C>A) {G=Math.round((C/2)-(A/2));} window.open('http://twitter.com/intent/tweet?text=' + t + '&url=' + u,'','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');
@brockboland
brockboland / letsfreckle-tags.js
Created July 23, 2012 16:42 — forked from anonymous/letsfreckle-tags.js
LetsFreckle tag performance fix
// ==UserScript==
// @name LetsFreckle Tags
// @namespace http://www.lullabot.com/
// @version 0.1
// @description Reduce the number of tags to fix performance issues.
// @match https://*.letsfreckle.com/*
// @copyright 2012+, Andrew Berry, [email protected]
// ==/UserScript==