Skip to content

Instantly share code, notes, and snippets.

View cfmitrah's full-sized avatar
🤓
Looking for new projects

Saravanamuthu Aka CF Mitrah cfmitrah

🤓
Looking for new projects
View GitHub Profile
<cfcomponent output="false">
<!--- Application settings --->
<cfset this.name = createUUID() />
<cfset this.sessionManagement = true>
<cfset this.sessionTimeout = createTimeSpan(0,0,30,0)>
<cfsetting showdebugoutput="yes">
<cfset this.mappings["/ModelGlue"] = getDirectoryFromPath(getCurrentTemplatePath()) & "ModelGlue/">
<cfset this.mappings["/ColdSpring"] = getDirectoryFromPath(getCurrentTemplatePath()) & "ColdSpring/">
<cfset this.mappings["/ApplicationName"] = getDirectoryFromPath(getCurrentTemplatePath())>
</cfcomponent>
@cfmitrah
cfmitrah / create_list.cfm
Created October 21, 2019 07:39
reating the audience list
<cfscript>
// Create List
addList = application.mailChimpService.addList();
writeDump(addList);abort;
</cfscript>
<!--- Here I have mentioned the sample code for generate the barcode for CODE-128 type --->
<cfdocument format="pdf" orientation="portrait" pagetype="a4">
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>BarCode Test</title>
</head>
<body>
<span style="font-family:CODE-128">AB123456ab789</span>
<cfoutput>
<!--- Here I have mentioned the code for create the object for different types of barcodes --->
<!--- For CODABAR --->
<cfset BarcodeCodabar = createobject("java","com.lowagie.text.pdf.BarcodeCodabar")>
<!--- For CODE39 --->
<cfset Barcode39 = createobject("java","com.lowagie.text.pdf.Barcode39")>
<!--- For CODE128 --->
<cfset Barcode128 = createobject("java","com.lowagie.text.pdf.Barcode128")>
<!--- For EAN13 & EAN8 --->
@cfmitrah
cfmitrah / sassCompilerListener.cfc
Last active March 18, 2019 05:30
Lucee Event Gateway - Sass Compiler Listener Component
<cfcomponent>
<cffunction name="compileSASS" access="public" output="no" returntype="void">
<cfargument name="data" type="struct" required="yes">
<cftry>
<cfset fileCompile(
arguments.data.directory,
arguments.data.name,
replaceNoCase(arguments.data.name, "scss", "css", "ALL")
)>
@cfmitrah
cfmitrah / demoGatewayListener.cfc
Created March 11, 2019 08:01
Demo Lucee Event Gateway - Listener Component
<cfcomponent>
<cfset variables.logFileName = "demoLogGateway" />
<cffunction name="checkChange" access="public" output="no" returntype="void">
<cfargument name="data" type="struct" required="yes">
<cfset logDetails("change:#serialize(data)#", "information")>
</cffunction>
<cffunction name="logDetails" returntype="void" access="private" output="no">
<cfargument name="content" required="yes" type="string" />
@cfmitrah
cfmitrah / demoGateway.cfc
Created March 11, 2019 07:57
Demo Lucee Event Gateway - Gateway Component
<cfcomponent extends="Gateway">
<cfset fields=array(
field("Directory","directory","",true,"The directory you want to watch","text")
,field("Watch subdirectories","recurse","true",true,"Should we watch the directory and all subdirectories too","checkbox")
,field("Interval (ms)","interval","60000",true,"The interval between checks, in miliseconds","text")
,field("File filter","extensions","*",true,"The comma separated list of file filters to match (* = all files). Examples: *user*,*.gif,2010*,myfilename.txt","text")
,group("CFC Listener Function Definition","Definition for the CFC Listener Functions, when empty no listener is called",3)
,field("Change","changeFunction","onChange",true,"called when a file change","text")
@cfmitrah
cfmitrah / demoDriver.cfc
Last active March 11, 2019 08:20
Demo Lucee Event Gateway - Driver Component
<cfcomponent output="no">
<cfset variables.logFileName = "demoLogGateway" />
<cfset variables.state="stopped" />
<cffunction name="init" access="public" output="no" returntype="void">
<cfargument name="id" required="false" type="string">
<cfargument name="config" required="false" type="struct">
<cfargument name="listener" required="false" type="component">
<cfscript>
clos = function( func ) { func(); };
clos( function(){
clos( function(){
writeDump( foo ?: "I am null" );
} );
} );
</cfscript>
@cfmitrah
cfmitrah / canadaPostRating.cfc
Last active July 11, 2017 14:46
MitrahSoft CanadaPost shipping API ColdFusion wrapper
<cfcomponent hint="Canada Post">
<cffunction name="init" access="public">
<cfargument name="apiKey" type="string" required="true" />
<cfargument name="customerNumber" type="string" required="true" />
<cfargument name="contractNumber" type="string" required="true" />
<cfset variables.apiKey = arguments.apiKey>
<cfset variables.customerNumber = arguments.customerNumber>
<cfset variables.contractNumber = arguments.contractNumber>