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> | |
input = [ | |
'[email protected]', | |
'bar@locahost', | |
'bar"locahost' | |
]; | |
foo = validateEmails(input); | |
writeDump(foo.hasErrors()); | |
writeDump(foo.getErrors()); |
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
// not intended for real-life usage :) | |
function range (start, end) { | |
return repeatString("_,", end-start+1).listToArray().map(function(el, i) { | |
return start+i-1; | |
}); | |
} |
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> | |
function test(pattern) { | |
return ReReplace(s, pattern, "-----", 'all'); | |
} | |
s = "Fred Bloggs says 'My name is Fred | |
bloGGs my brother is Alfred Bloggs and I blog about people called fred or freddie'. x:Fred bloggss y: Fred bloggsss Yours FRED BLOGGS"; | |
variations = [ | |
"(?im)(?:(\b|^)Fred\s+Bloggss?(\b|$))", | |
"(?im)(\b|^)Fred\s+Bloggss?(\b|$)", | |
"(?im)\bFred\s+Bloggss?\b", |
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
SELECT * | |
FROM ( | |
SELECT uuid, | |
row_number() over (ORDER BY uuid) AS rn, | |
count(*) over () AS totalrows | |
FROM tblfoo | |
) AS tmp | |
WHERE rn BETWEEN 212201 AND 212210 | |
ORDER BY uuid | |
; |
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 displayname="GIS Plant Asset Service" extends="app.model.services.baseService" accessors="true" { | |
property assetGateway; | |
public array function list() { | |
return populateBeans( "assetBean", assetGateway.select() ); | |
} | |
public array function getByAssetID ( required string assetid ) { | |
var data = assetGateway.select( { assetid : assetid } ); |
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 { | |
function init(required query data){ | |
setQuery(arguments.data); | |
return this; | |
} | |
/* ---------------------------- PUBLIC ---------------------------- */ | |
/* --- Iterator methods ---------------------------- */ |
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> | |
// asked in cfml slack #cfml-beginners | |
function getNodePaths(xmldoc) { | |
var nodes = extractTextNodes(xmldoc); | |
var xPaths = []; | |
for (var node in nodes) { | |
xPaths.append(getXPath(node)); | |
} | |
return xPaths; |
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 extends="testbox.system.BaseSpec" { | |
function run(testResults, testBox) { | |
Feature("TestSuite", function() { | |
Given("I want to use TestBox", function() { | |
When("I run the TestSuite", function() { | |
Then("It should find and run tests", function() { | |
expect(true).toBeTrue(); |
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
SELECT SUBSTRING_INDEX('1/2/3/4/500', '/', -1) AS last_element; |
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> | |
x = [ | |
"a":1, | |
"z":2, | |
"b":3 | |
]; | |
y = { | |
"a":1, |