Skip to content

Instantly share code, notes, and snippets.

<cfscript>
numbers = [
one = "tahi",
two = "rua",
three = "toru",
four = "wha"
]
cfwddx(action="cfml2wddx", output="asWddx", input=numbers)
cfwddx(action="wddx2cfml", output="asStruct", input=asWddx)
<cffunction name="createLink">
<cfargument name="arg_regId" type="string" required="true">
<cfargument name="arg_attendNo" type="string" required="true">
<cfargument name="first_name" type="string" required="true">
<cfargument name="last_name" type="string" required="true">
<cfargument name="reg_code_for_fees" type="string" required="true">
<cfargument name="event_title" type="string" required="true">
<cffunction name="createLink">
<cfargument name="arg_regId" type="string" required="true">
<cfargument name="arg_attendNo" type="string" required="true">
<cfargument name="first_name" type="string" required="true">
<cfargument name="last_name" type="string" required="true">
<cfargument name="reg_code_for_fees" type="string" required="true">
<cfargument name="event_title" type="string" required="true">
<cfscript>
pattern = "";
tests = {
validLotNo1 = "1234567A",
validLotNo2 = "12345678",
validLotNo3 = "12A",
invalidLotNo1 = "",
invalidLotNo2 = "A",
invalidLotNo3 = "1234567^"
};
<cfscript>
pattern = "";
tests = {
validLotNo1 = "1234567A",
validLotNo2 = "12345678",
validLotNo3 = "12A",
invalidLotNo1 = "",
invalidLotNo2 = "A",
invalidLotNo3 = "1234567^"
};
<cfscript>
<!---array1=[{'fruit'='mango','rating'=3},{'fruit'='grapes','rating'=4},{'fruit'='lemon','rating'=2}];
filteredvalue=arrayFilter(array1,funtion(item)
{
return item.rating >= 2;
});
writeDump(serializeJSON(filteredvalue));--->
<cfscript>
originalText = "Hello World!";
// Step 1: Convert string to binary
binaryData = ToBinary( ToBase64(originalText) ); // this is NOT what you want here
// Instead: Convert string to raw bytes (Java-style)
byteArray = CharsetDecode(originalText, "utf-8");
// Step 2: Encode binary to Base64
<cfscript>
originalText = "Hello World!";
// Step 1: Convert string to binary
binaryData = ToBinary( ToBase64(originalText) ); // this is NOT what you want here
// Instead: Convert string to raw bytes (Java-style)
byteArray = CharsetDecode(originalText, "utf-8");
// Step 2: Encode binary to Base64
<cfscript>
originalText = "Hello World!";
// Step 1: Convert string to binary
binaryData = ToBinary( ToBase64(originalText) ); // this is NOT what you want here
// Instead: Convert string to raw bytes (Java-style)
byteArray = CharsetDecode(originalText, "utf-8");
// Step 2: Encode binary to Base64
<cfscript>
// Use a 16-byte (128-bit) AES key
key = "12345678901234567890123456789012"; // 16 characters
// Text to encrypt
originalText = "kiosk";
// Encrypt the text (returns Base64 string)
encryptedBinary = encrypt(originalText, key, "AES", "Base64");