View test.cfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// Our build-function is going to return a generator function that produces values | |
// with the given weighted frequencies. | |
next = buildWeightedDistribution([ | |
{ value: "a", percent: 10 }, | |
{ value: "b", percent: 20 }, | |
{ value: "c", percent: 70 } | |
]); |
View Application.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component | |
output = false | |
hint = "I define the application settings and event handlers." | |
{ | |
// Define the application settings. | |
this.name = "CompoundPathMappingTest"; | |
this.applicationTimeout = createTimeSpan( 0, 1, 0, 0 ); | |
// When referencing ColdFusion components, paths are delimited with "." instead of |
View core-count.cfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
coreCount = createObject( "java", "java.lang.Runtime" ) | |
.getRuntime() | |
.availableProcessors() | |
; | |
dump( coreCount ); | |
</cfscript> |
View array-out.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... (truncated for post) .... | |
[INFO ] string 93: 99 | |
[INFO ] string 90: 100 | |
[INFO ] string 87: 100 | |
[INFO ] string 94: 100 | |
[INFO ] string 100: 99 | |
[INFO ] string 99: 98 | |
[INFO ] string 92: 100 | |
[INFO ] string 97: 99 | |
[INFO ] string 96: 99 |
View Flag.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component | |
output = false | |
hint = "I provide access to a flag value which is refreshed asynchronously." | |
{ | |
/** | |
* I initialize the flag value. | |
*/ | |
public void function init() { |
View test.cfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
// The following pattern uses a VERBOSE Regular Expression flag to allow for comments | |
// and whitespace to make the pattern easier to read. In this case, we're attempting | |
// to extract parts of an email address using NAMED CAPTURE GROUPS. | |
pattern = "(?x)^ | |
(?<user> [^+@]+ ) | |
( | |
\+ (?<hash> [^@]+ ) | |
)? |
View test.cfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
jre = new JRegEx(); | |
// The following pattern uses a VERBOSE Regular Expression flag to allow for comments | |
// and whitespace to make the pattern easier to read. This pattern attempts to capture | |
// the aspects of an HTTP URL. | |
pattern = "(?x)^ | |
## Protocol extraction. | |
( https?:// | // )? |
View Application.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component | |
output = false | |
hint = "I define the application settings and event handlers." | |
{ | |
// Configure application management. | |
this.name = "SessionHeartBeatDemo"; | |
this.applicationTimeout = createTimeSpan( 1, 0, 0, 0 ); | |
// Configure session management. |
View snippet-1.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component { | |
public void function updateThing( | |
required numeric id, | |
string valueOne, | |
string valueTwo, | |
string valueThree | |
) { | |
``` |
View create-table.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `double_submission_token` ( | |
`token` varchar(50) NOT NULL, | |
`expiresAt` datetime NOT NULL, | |
PRIMARY KEY (`token`), | |
KEY `IX_byExpiration` (`expiresAt`) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
NewerOlder