This file contains hidden or 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> | |
| // Some dummy articles yay! | |
| articles = [ | |
| {title: "I Am a Title Perhaps", publishDate: createDate(2015, 11, 08)}, | |
| {title: "I Am a Title As Well", publishDate: createDate(2014, 08, 15)}, | |
| {title: "I Am a Title I Think", publishDate: createDate(2014, 09, 25)}, | |
| {title: "I Am a Title", publishDate: createDate(2013, 04, 05)}, | |
| {title: "I Am a Title Too", publishDate: createDate(2013, 05, 17)}, | |
| {title: "I Am a Title Also", publishDate: createDate(2013, 07, 02)} | |
| ]; |
This file contains hidden or 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 name="Watermark" | |
| output="false" | |
| { | |
| public any function init() { | |
| variables.AlphaComposite = createObject("java", "java.awt.AlphaComposite"); | |
| variables.Color = createObject("java", "java.awt.Color"); | |
| variables.Font = createObject("java", "java.awt.Font"); | |
| variables.jFile = createObject("java", "java.io.File"); | |
| variables.AffineTransform = createObject("java", "java.awt.geom.AffineTransform"); | |
| variables.ImageIO = createObject("java", "javax.imageio.ImageIO"); |
This file contains hidden or 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> | |
| FORM.InputField = "<b>This</b> is some <em>string</em> text with <s>HTML</s> all up in it."; | |
| example1 = reReplaceNoCase(FORM.InputField, "[^a-zA-Z\d\s:]", "", "ALL"); | |
| example2 = reReplaceNoCase(FORM.InputField, "<[^>]*>", "", "ALL"); | |
| writeDump("Example 1: " & example1); | |
| writeOutput("<br>"); | |
| writeDump("Example 2: " & example2); | |
| </cfscript> |
This file contains hidden or 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
| http { | |
| ... | |
| server { | |
| listen 80; | |
| server_name mysite.local www.mysite.local; | |
| root C:\websites\mysite\www; | |
| index index.cfm; |
This file contains hidden or 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
| <?xml version='1.0' encoding='utf-8'?> | |
| <!-- The contents of this file will be loaded for each web application --> | |
| <Context> | |
| <!-- REWRITE VALVE --> | |
| <Valve className="org.apache.catalina.valves.rewrite.RewriteValve" /> | |
| <!-- // --> | |
| <!-- Speed up context loading --> | |
| <JarScanner scanClassPath="false" /> | |
| <!-- Default set of monitored resources. If one of these changes, the --> |
This file contains hidden or 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> | |
| array function nextIds(required array ids, required numeric id, numeric count = 0) { | |
| var idPos = arguments.ids.find(arguments.id); | |
| return arguments.ids.filter(function(item, index) { | |
| return idPos && index != idPos && index <= idPos + count; | |
| }); | |
| } | |
| writeDump( nextIds([7141, 6881, 5821, 8001, 7904, 6601, 7961, 6021, 4721], 7141, 3) ); |
This file contains hidden or 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
| <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false"> | |
| <Context path="" docBase="C:\websites\coldfusion2016\wwwroot" workDir="C:\ColdFusion2016\cfusion\runtime\conf\Catalina\localhost\tmp"> | |
| <Resources> | |
| <PreResources className="org.apache.catalina.webresources.DirResourceSet" base="C:\ColdFusion2016\cfusion\wwwroot\CFIDE" webAppMount="/CFIDE" /> | |
| <PreResources className="org.apache.catalina.webresources.DirResourceSet" base="C:\ColdFusion2016\cfusion\wwwroot\WEB-INF" webAppMount="/WEB-INF" /> | |
| </Resources> | |
| </Context> | |
| </Host> |
This file contains hidden or 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
| print( ['a', 'at', 'cat', 'scat', 'catch'].find { it ==~ '.+at' } ) |
This file contains hidden or 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> | |
| example = ["a", "b", "c", "a", 1, 2, 1]; | |
| HashSet = createObject("java", "java.util.HashSet"); | |
| Arrays = createObject("java", "java.util.Arrays"); | |
| result = HashSet.init(Arrays.asList(example)).toArray(); | |
| writeDump(result); |
This file contains hidden or 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> | |
| string function randomAlphaNumericString(required numeric length) { | |
| var alphaNum = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; | |
| var SecureRandom = new java("java.security.SecureRandom"); // Note: CF2018 syntax | |
| var rng = SecureRandom.getInstanceStrong(); | |
| var result = ""; | |
| for (var i = 0; i < arguments.length; i++) { | |
| result &= alphaNum.charAt( rng.nextInt(alphaNum.len()) ); |