Skip to content

Instantly share code, notes, and snippets.

@sprice
sprice / default_images.php
Created March 8, 2012 19:54
Provide image field default images in Drupal 7
<?php
// General function in base feature or custom module.
/**
* Return a file object after saving a default image and storing the fid
* in a variable.
*
* @param $default_image
* An associative array containing:
[21-Jan-2012 20:25:41] ThemeRegistry extends DrupalCacheArray constructor
[21-Jan-2012 20:25:41] SchemaCache extends DrupalCacheArray constructor
[21-Jan-2012 20:25:41] DrupalCacheArray constructor class type SchemaCache
[21-Jan-2012 20:25:41] DrupalCacheArray constructor cid: schema:runtime:1
[21-Jan-2012 20:25:41] DrupalCacheArray destructor class type ThemeRegistry
[21-Jan-2012 20:25:41] DrupalCacheArray destructor cid:
[21-Jan-2012 20:25:41] PHP Notice: Trying to get property of non-object in /Users/shawn/Sites/personaldev/mongodrop/public_html/profiles/mongodrop/modules/contrib/mongodb/mongodb_watchdog/mongodb_watchdog.module on line 100
[21-Jan-2012 20:25:41] PHP Stack trace:
[21-Jan-2012 20:25:41] PHP 1. DrupalCacheArray->__destruct() /Users/shawn/Sites/personaldev/mongodrop/public_html/includes/bootstrap.inc:0
[21-Jan-2012 20:25:41] PHP 2. ThemeRegistry->set() /Users/shawn/Sites/personaldev/mongodrop/public_html/includes/bootstrap.inc:424
diff --git a/mongodb_session/mongodb_session.inc b/mongodb_session/mongodb_session.inc
index b574982..b69a157 100644
--- a/mongodb_session/mongodb_session.inc
+++ b/mongodb_session/mongodb_session.inc
@@ -107,7 +107,8 @@ function _drupal_session_read($sid) {
// active user.
if ($session && !empty($session['uid'])) {
$collection = mongodb_collection('fields_current', 'user');
- $user = (object) $collection->findOne(array('_id' => $session['uid']));
+ $user = $collection->findOne(array('_id' => $session['uid']));
diff --git a/mongodb_session/mongodb_session.inc b/mongodb_session/mongodb_session.inc
index b574982..05e08f2 100644
--- a/mongodb_session/mongodb_session.inc
+++ b/mongodb_session/mongodb_session.inc
@@ -105,7 +105,7 @@ function _drupal_session_read($sid) {
// We found the client's session record and they are an authenticated,
// active user.
- if ($session && !empty($session['uid']) && $session['status'] == 1) {
+ if ($session && !empty($session['uid'])) {
@sprice
sprice / .bash_profile
Created November 24, 2011 20:13
My bash PS1
#show git on prompt
RED='\[\033[0;31m\]'
YELLOW='\[\033[0;33m\]'
GREEN='\[\033[1;32m\]'
BLUE='\[\033[01;34m\]'
WHITE='\[\033[00m\]'
BONE='☠'
PS1='${debian_chroot:+($debian_chroot)}'$GREEN'\u@\h'$WHITE':'$BLUE'\w'$YELLOW' $(__git_ps1 "(%s)")'$RED' \[$BONE\] '$WHITE''
diff --git atrium_calendar/atrium_calendar.feeds_importer_default.inc atrium_calendar/atrium_calendar.feeds_importer_default.inc
index 0ecc787..856048a 100644
--- atrium_calendar/atrium_calendar.feeds_importer_default.inc
+++ atrium_calendar/atrium_calendar.feeds_importer_default.inc
@@ -54,6 +54,11 @@ function atrium_calendar_feeds_importer_default() {
'target' => 'created',
'unique' => FALSE,
),
+ 5 => array(
+ 'source' => 'guid',
diff --git ideation.features.content.inc ideation.features.content.inc
index 9b29bd6..f12c643 100644
--- ideation.features.content.inc
+++ ideation.features.content.inc
@@ -53,10 +53,10 @@ function ideation_content_default_fields() {
'active' => '1',
'text_processing' => '0',
'max_length' => '',
- 'allowed_values' => 'Mathematics
-English
@sprice
sprice / change_ideas_categories.patch
Created February 22, 2011 21:12
Change the categories of the Drupal Ideation feature
diff --git ideation.features.content.inc ideation.features.content.inc
index 9b29bd6..f12c643 100644
--- ideation.features.content.inc
+++ ideation.features.content.inc
@@ -53,10 +53,10 @@ function ideation_content_default_fields() {
'active' => '1',
'text_processing' => '0',
'max_length' => '',
- 'allowed_values' => 'Mathematics
#!/bin/bash
drush @alias searchlight-searchd stop
drush @alias site-install simple --db-url=mysql://user:pass@localhost/db
drush @alias cc all
drush @alias generate-content 100
drush @alias cc all
drush @alias searchlight-conf
drush @alias searchlight-index
drush @alias searchlight-searchd

Installing Sphinx on OSX 10.6 with MAMP 1.9.4

The MAMP 1.9.4 MySQL installation is missing the include directory and certain libraries.

Download the MAMP 1.9 Components

Extract mysql-5.1.44.tar.gz and compile to /opt/local

cd mysql-5.1.44

./configure --prefix=/opt/local