Skip to content

Instantly share code, notes, and snippets.

@cflove
cflove / winSCP.cfm
Last active September 24, 2020 02:15
ColdFusion custom tag to work with WinSCP / sftp. This use external files and write hostkey and script file in the same dir location of the custom tag template. Change default attributes. This need WinSCP installed in the server.
<!---
<cf_WinSCP action ="listdir"
username =""
password =""
host =""
name ="qryDirectory"
directory ="" />
<cf_WinSCP action="exists"
username =""
cfabort
cfajaximport
cfajaxproxy
cfapplet
cfapplication
cfargument
cfassociate
cfauthenticate
cfcalendar
cfchartdata
@cflove
cflove / CreateFavIcon.cfm
Last active November 8, 2023 05:59
create a favicon.icon file with coldfusion
<cffunction name="createFavicon" access="public" returntype="void">
<cfargument name="letter" type="string" required="true">
<cfargument name="saveLocation" type="string" required="true">
<!--- Set image dimensions (16x16 pixels) --->
<cfset width = 16>
<cfset height = 16>
<!--- Create a buffered image with transparency --->
<cfset BufferedImage = createObject("java", "java.awt.image.BufferedImage")>
<cfexecute name="aws" arguments="configure set aws_access_key_id xxx"></cfexecute>
<cfexecute name="aws" arguments="configure set aws_secret_access_key xxx"></cfexecute>
<cfexecute name="aws" arguments="configure set region us-east-1"></cfexecute>
<cfexecute name="aws" arguments="configure set output json"></cfexecute>
CREATE OR REPLACE FUNCTION isNull(value_to_check ANYELEMENT, replacement_value ANYELEMENT)
RETURNS ANYELEMENT AS $$
BEGIN
RETURN COALESCE(value_to_check, replacement_value);
END;
$$ LANGUAGE plpgsql IMMUTABLE;