Skip to content

Instantly share code, notes, and snippets.

View rip747's full-sized avatar

Anthony Petruzzi rip747

View GitHub Profile
@rip747
rip747 / cfmiddleware
Created January 4, 2011 22:06
cfmiddleware
<cfcomponent>
<cfset $class = {}>
<cffunction name="init">
<cfargument name="relativePath" type="string" default="" hint="the relative component path from the webroot">
<cfset $class.container = []>
<cfset $class.relativePath = arguments.relativePath>
</cffunction>
@rip747
rip747 / cfwheels gitignore
Created November 23, 2010 14:01
cfwheels gitignore
# unpacked plugin folders
plugins/**/*
# files directory where uploads go
files
# DBMigrate plugin: generated SQL
db/sql
# AssetBundler plugin: generated bundles
@rip747
rip747 / cfwheels password handling in models
Created November 16, 2010 16:53
cfwheels password handling in models
<!---
this is for wheels.1.1
--->
<cffunction name="init">
<cfset afterFind("passwordToBlank")>
<cfset beforeSave("passwordProtection")>
<!---
only valid the password when creating a record or if the password isn't
blank. this allows you to not enter anything when updating a record
@rip747
rip747 / wheels 1.1 settings
Created November 10, 2010 11:19
default settings for wheels 1.1
<!--- disable automatic validations --->
<cfset set(automaticValidations=false)>
<!--- delay redirections --->
<cfset set(functionName="redirectTo", delay=true)>
<!--- disable automatic form field labels --->
<cfset set(functionName="textField", label=false)>
<cfset set(functionName="textFieldTag", label=false)>
<cfset set(functionName="passwordField", label=false)>
<cfset set(functionName="passwordFieldTag", label=false)>
@rip747
rip747 / split_repo.bash
Created October 21, 2010 15:57 — forked from pk/split_repo.bash
git extract directory into it's own repo
#!/bin/bash
FROM=$1 #/cygdrive/c/temp/oldrepo
TO=$2 #/cygdrive/c/temp/newrepo
echo "Spliting '$TO' from '$FROM'"
git clone --no-hardlinks $FROM $TO
cd $TO
git filter-branch --subdirectory-filter $TO HEAD -- --all
git reset --hard
From 8922990286e83f9d9307d07dbc286b7d4ecb348e Mon Sep 17 00:00:00 2001
From: Tony Petruzzi <tpetruzzi@gmail.com>
Date: Mon, 27 Sep 2010 16:59:40 -0400
Subject: [PATCH] saving work
---
wheels/controller/layouts.cfm | 2 +-
wheels/controller/rendering.cfm | 1 +
wheels/global/appfunctions.cfm | 2 +
wheels/global/cfml.cfm | 18 +++++
' This script will add a host header to an existing site in IIS6
' First save this script to a file
' Then run simply by calling the script from the command line passing in the arguments:
' 1) the Site Name in IIS (can be found under the description header)
' 2) the IPAddress of the host header you
' 3) the Port number for the host header (usually 80)
' 4) the full qualified host (domain) name
' EXAMPLE: wscript addHostHeader.vbs mytestsite 127.0.0.1 80 site3.example.com
Const IISService = "IIS://localhost/w3svc"
Controller save method
======================
<cffunction name="save">
<cfif len(params.chapter.chapterid)>
<cfset chapter = model("chapter").findByKey(params.chapter.chapterid)>
<cfset chapter.setproperties(params.chapter)>
<cfset _page.title = _pageTitle("edit")>
<cfelse>
@rip747
rip747 / arrays to excel
Created April 23, 2010 17:54
using java to create an excel spreadsheet
<cfscript>
workBook = createObject("java", "org.apache.poi.hssf.usermodel.HSSFWorkbook").init();
newSheet = workBook.createSheet();
workBook.setSheetName(0, "1");
count = 0;
</cfscript>
<cfloop array="#headers#" index="i">
<cfscript>
row = newSheet.createRow(0);
cell = row.createCell(count);
@rip747
rip747 / CF8 Application.cfc
Created February 18, 2010 18:00
skeleton application.cfc file for cf8
<cfcomponent output="false">
<!--- Application name, should be unique --->
<cfset this.name = Hash(GetDirectoryFromPath(GetBaseTemplatePath()))>
<!--- How long application vars persist --->
<cfset this.applicationTimeout = createTimeSpan(0,2,0,0)>
<!--- define custom coldfusion mappings. Keys are mapping names, values are full paths --->
<cfset this.mappings = structNew()>
<!--- define a list of custom tag paths. --->
<cfset this.customtagpaths = "">