Skip to content

Instantly share code, notes, and snippets.

View rip747's full-sized avatar

Anthony Petruzzi rip747

View GitHub Profile
@rip747
rip747 / cfwheels git exclude
Created June 2, 2009 15:37
cfwheels git exclude
.project
IsapiRewrite4.dll
.project
<!---
Takes a .Net dataset and converts it to a CF structure of queries.
--->
<cffunction name="convertDotNetDataset" access="public" returnType="struct" output="false"
hint="takes a .Net dataset and converts it to a CF structure of queries">
<cfargument name="dataset" required="true">
<cfset var Local = StructNew()>
<cfset Local.result = structNew() />
<cfset Local.aDataset = arguments.dataset.get_any() />
<cfset Local.xSchema = xmlParse(Local.aDataset[1]) />
<!---
Converts an excel file to a structure of arrays
Modded by Raymond Camden to fix incorrect col count
added minor changes from Tony
@param excelFile Excel file to parse. (Required)
@return Returns a struct of arrays.
@author anthony petruzzi (tpetruzzi@gmail.com)
@version 1, Sep 13, 2011
http://gist.github.com/138954
@rip747
rip747 / instructions for converting from svn to git
Created July 28, 2009 17:49
instructions for converting from svn to git
(no author) = Unknown Author <unknown@example.com>
tpetruzzi = Tony Petruzzi <tpetruzzi@gmail.com>
$ git svn clone --stdlayout --no-metadata --authors-file=authors.txt <svn_repo_url> <git_tmp_repo_dir>
$ cd <git_tmp_repo_dir>
$ git branch -r | sed -rne 's, *tags/([^@]+)$,\1,p' | while read tag; do echo "git tag $tag 'tags/${tag}^'; git branch -r -d tags/$tag"; done | sh
$ git branch -r | grep -v tags | sed -rne 's, *([^@]+)$,\1,p' | while read branch; do echo "git branch $branch $branch"; done | sh
@rip747
rip747 / Managed Fusion configuration for glassfish
Created August 14, 2009 13:52
Managed Fusion configuration for glassfish
== Web.config ==
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="managedFusion.rewriter" type="ManagedFusion.Rewriter.Configuration.ManagedFusionRewriterSectionGroup"/>
</configSections>
<managedFusion.rewriter xmlns="http://managedfusion.com/xsd/managedFusion/rewriter">
<rules engine="Apache">
<apache defaultFileName="ManagedFusion.Rewriter.txt" />
@rip747
rip747 / git exportfiles alias
Created August 15, 2009 18:16
exportfiles for git
exportfiles = !sh -c 'git diff $0 --name-only | "while read files; do mkdir -p \"$1/$(dirname $files)\"; cp -vf $files $1/$(dirname $files); done"'
@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 = "">
@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);
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>