Skip to content

Instantly share code, notes, and snippets.

@shanestillwell
shanestillwell / BootstrapFile.php
Created January 3, 2011 17:22
Edit the Bootstrap for the Zend Tool to pull the APPLICATION_ENV from the shell.
--- BootstrapFile.php (saved version)
+++ (current document)
@@ -106,9 +106,11 @@
define('APPLICATION_PATH', $this->_applicationDirectory->getPath());
$applicationOptions = array();
$applicationOptions['config'] = $this->_applicationConfigFile->getPath();
+
+ $env = getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development';
$this->_applicationInstance = new Zend_Application(
@shanestillwell
shanestillwell / toHeirarchy.php
Created January 4, 2011 14:31
Converts a NestedSet array into a mutli-dimensional array (Hydrates the flat array returned by Doctrine)
/**
* original http://groups.google.com/group/doctrine-user/browse_thread/thread/8674c5f27de54e0c
*/
public function toHierarchy($collection)
{
// Trees mapped
$trees = array();
$l = 0;
<?php
/**
* UploadController
*
* @author
* @version
*/
class UploadController extends Zend_Controller_Action
@shanestillwell
shanestillwell / nginx.conf
Created May 23, 2011 17:01
Nginx Map HTTPS variable
map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}
@shanestillwell
shanestillwell / nameparse.php
Created July 6, 2011 01:11
Parse names in PHP
<?
/*
Name: nameparse.php
Version: 0.2a
Date: 030507
First: 030407
License: GNU General Public License v2
Bugs: If one of the words in the middle name is Ben (or St., for that matter),
or any other possible last-name prefix, the name MUST be entered in
last-name-first format. If the last-name parsing routines get ahold
@shanestillwell
shanestillwell / gist:1178492
Created August 29, 2011 14:21
Get mailbox and size for Cyrus Imap Server users
du -h /var/spool/imap/[a-z]/user | egrep -v ".*[a-z]/user/.*/" | egrep .*[a-z]/user/
@shanestillwell
shanestillwell / convert.php
Created November 3, 2011 00:27
Convert Drupal Audio content type to CCK Filefield
<?php
$user="USERNAME";
$password="PASSWORD";
$database="DATABASE";
mysql_connect('localhost',$user,$password);
mysql_select_db($database) or die( "Unable to select database");
// Query all the audio nodes.
$q = <<<SQL
@shanestillwell
shanestillwell / .git-completion.bash
Created December 11, 2011 02:16
Git tab completion for BASH
#!bash
#
# bash/zsh completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
#### THE Output of this PHPUnit test is
..//test.css?v=1323800589//test.css?v=1323800589.
<?php
$result = $this->object->revver('/test.css');
print $result;
$hello = file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/test.css', '/** Just a dummy file for testing */');
//$this->assertNotEquals($result, $this->object->revver('/test.css'));
print $this->object->revver('/test.css');
@shanestillwell
shanestillwell / php-cgi.sh
Created January 2, 2012 21:10
PHP CGI startup script
#!/bin/sh
#
# php-cgi - php-fastcgi swaping via spawn-fcgi
#
# chkconfig: - 85 15
# description: Run php-cgi as app server
# processname: php-cgi
# config: /etc/sysconfig/phpfastcgi (defaults RH style)
# pidfile: /var/run/php_cgi.pid
# Note: See how to use this script :