Skip to content

Instantly share code, notes, and snippets.

@coen-hyde
coen-hyde / gist:1258108
Created October 2, 2011 23:38 — forked from tholder/gist:1257513
Problem updating document set of existing doc
<?
/**
* Represents the invite system. The invite collection contains one document for each invited email address.
**/
class Model_Mongo_Invite extends Shanty_Mongo_Document {
protected static $_db = 'contactzilla';
protected static $_collection = 'invite';
protected static $_requirements = array(
@coen-hyde
coen-hyde / shanty-mongo-referenes-test
Created July 16, 2011 08:35
Shanty Mongo references test
<?php
define('ZEND_LIBRARY_DIR', '...');
define('SHANTY_MONGO_LIB_DIR', '...');
ini_set('include_path', SHANTY_MONGO_LIB_DIR . ':' . ZEND_LIBRARY_DIR . ':' . ini_get('include_path'));
require_once("Zend/Loader/Autoloader.php");
$autoloader = Zend_Loader_Autoloader::getInstance();
<?php
class ResistanceFighter extends Shanty_Mongo_Document
{
protected static $_collectionName = 'resistancefighter';
protected $_requirements = array(
'name' => 'Document:ResistanceFighter_Name',
'email' => array('NotEmpty', 'EmailAddress'),
'address' => 'Document',
@coen-hyde
coen-hyde / beer.sh
Last active August 29, 2015 14:25
Add this snippet to you bash profile to give you the power of beer.
ROOT_PROJECT_DIR=$HOME/projects/
proot() {
echo $(echo $PWD | sed "s|\($ROOT_PROJECT_DIR[A-Za-z]*\).*|\1|")
}
beer() {
spec=$1
shift
cd $(proot); bundle exec rspec ./spec/$spec $@