Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>untitled</title>
<meta name="generator" content="TextMate http://macromates.com/">
<meta name="author" content="Steven Ross">
<style type="text/css" media="screen">
class reader:
def __init__(self):
self.s = str
def main(self, part='body'):
for req in self.requests():
#self.body = {'response': req['body']}
return req[part]
#self.respond(data={"response": req['body']})
@steve-ross
steve-ross / ObjectFactory.cfc
Created June 15, 2012 14:34
Object Factory
<cfcomponent output="false" hint="Object Factory for Singleton instantiation">
<!--- cleanup cache will only be called on every 500th call to the get function (will rehash the table) --->
<cfset this.currentCacheInterval = 1 />
<cfset this.cacheClearIntervalInMinutes = 180 />
<cffunction name="init">
<cfargument name="isDebug" type="boolean" required="false" hint="pass in true to reload every time" default="false" />
<cfscript>
setCacheTime();
@steve-ross
steve-ross / .bash_profile
Created June 28, 2012 22:16
bash completions
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
LIGHT_BLUE="\[\033[1;36m\]"
COLOR_NONE="\[\e[0m\]"
#!bash
#
# bash 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:
#
@steve-ross
steve-ross / gist:3927019
Created October 21, 2012 13:46
Upload a file in couchdb with jQuery
$('#upload_file').submit(function(e){
e.preventDefault();
var data = {};
$("form :file").each(function() {
data[this.name] = this.value; // file inputs need special handling
});
$(this).ajaxSubmit({
url: database_url + '/' + $('#_id').val() ,
dataType: 'json',
if testing:
#drop all the agency db's and new users
print 'dropping all agency databases'
for db in self.server:
if (db.find('agency_') == 0 or db.find('agents') == 0):
del self.server[db]
@steve-ross
steve-ross / gist:5006574
Created February 21, 2013 17:37
magento select *...
$ids = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSelect('entity_id')
->addFieldToFilter('status', array('eq'=>'1'))
->addFieldToFilter('type_id', array('in'=>array('configurable', 'simple')))
->getSelect();
produces:
string 'SELECT `e`.*, `at_status`.`value` AS `status` FROM `catalog_product_entity` AS `e`
#STARTS ON OR AROUND LINE 171
DocumentRoot "/Users/sross/Documents/work/projects/www"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
SetEnv MAGE_IS_DEVELOPER_MODE=true
RewriteBase /
############################################
## uncomment these lines for CGI mode
## make sure to specify the correct cgi php binary file name
## it might be /cgi-bin/php-cgi
# Action php5-cgi /cgi-bin/php5-cgi
# AddHandler php5-cgi .php