Skip to content

Instantly share code, notes, and snippets.

@orangexception
orangexception / gist:3136496
Created July 18, 2012 14:26
Reset Custom Tag Paths to ExpandPath( "/WEB-INF/cfusion/CustomTags" )
// Reset Custom Tag Paths to ExpandPath( "/WEB-INF/cfusion/CustomTags" )
var oCFIDEExtensions= new CFIDE.adminapi.extensions();
var asCustomTagPaths= oCFIDEExtensions.getCustomTagPaths();
for( var sCustomTagPath in asCustomTagPaths ) {
oCFIDEExtensions.deleteCustomTagPath( sCustomTagPath );
}
oCFIDEExtensions.setCustomTagPath( ExpandPath( "/WEB-INF/cfusion/CustomTags" ) );
@orangexception
orangexception / gist:2023943
Created March 12, 2012 18:53
I feel like I should make a Shadow joke here, but basically I get tired of seeing this in individual queries.
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION dbo.sensitiveDataMask
(
@sTarget varchar( 16 )
)
@orangexception
orangexception / gist:1933472
Created February 28, 2012 16:27
Things could get grimmy
<cffunction name= "grimRequestStructure"
output= "false"
access= "private"
hint= "I convert valid html escaped strings into their code format.">
<cfargument name= "stTarget" />
<cfargument name= "bDuplicate"
required= "false"
default= "true"
@orangexception
orangexception / gist:1856814
Created February 18, 2012 01:47
The dumb things I do because DirectoryList doesn't have a proper filter...
var sPath= ExpandPath( "/" );
var qDirectoryList= DirectoryList( sPath ,
true ,
"query" );
var qoqDirectoryList= new Query();
qoqDirectoryList.setAttributes( qDirectoryList= qDirectoryList );
qoqDirectoryList.setDBType( "query" );
@orangexception
orangexception / gist:1854342
Created February 17, 2012 16:53
Populating Export Fields when DataTable changes
// Add to callback chain from DataTable.fnDrawCallback, assumes target DataTable is global variable called oTable.
function onDataTableSearchSortAndFilterChangeHandler () {
$( "#sSearch" ).val(
$( ".dataTables_filter label input" ).val() );
if( typeof( oTable ) === "undefined" )
return;
var aaSorting= oTable.fnSettings().aaSorting;
@orangexception
orangexception / gist:1854331
Created February 17, 2012 16:50
Get current sorting array for DataTables
// Useful little function for getting at the guts of DataTables.
var aaSorting= oTable.fnSettings().aaSorting;
@orangexception
orangexception / gist:1364339
Created November 14, 2011 16:22
Merge Arrays in ColdFusion
<cfscript>
// This gist uses underlying Java to merge arrays.
aOne= [1,2,3];
aTwo= [4,5,6];
aMerge= duplicate( aOne );
aMerge.addAll( aTwo );
</cfscript>
@orangexception
orangexception / gist:1344944
Created November 7, 2011 13:25
Create list of java files in a directory
<cfdirectory directory= "#ExpandPath( "/src" )#"
name= "qFiles"
filter= "*.java"
recurse= "true" />
<cfset sOutput= "" />
<cfloop query= "qFiles">
<cfset sOutput&= directory & "/" & name & chr( 10 ) />
</cfloop>
@orangexception
orangexception / gist:1301150
Created October 20, 2011 13:33
Minify JavaScript Regular Expression

Notice

Do not run this against minified JavaScript packages. The minified packages often rely on line returns to execute correctly.

This regular expression was designed to minify simple JavaScript.

Regular Expression

(?s)[\t\r\n]|[ ][ ]+|/\*.*?\*/*

I put spaces in square brackets as a reminder that they exist. Spaces can be important. For example, $( "#foo #bar" ) should not become $("#foo#bar"). However, we do want to remove spaces if they are used for indentation.

@orangexception
orangexception / gist:1292778
Created October 17, 2011 14:53
Minify CSS Regular Expression

Regular Expression

(?s)\s|/\*.*?\*/

Usage in ColdFusion

I've tested with ColdFusion 8 and Railo 3.3.

sCSSContent= sCCSContent.ReplaceAll( "(?s)\s|/\*.*?\*/" , "" );

Test Cases