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
function preCreate( event, rc, prc ) { | |
param rc.productId = ""; | |
if ( !isValid( "integer", rc.productId ) ) { | |
// this error should be caught by the aroundHandler, but does not! | |
throw( message="Bad Product", type="BadRequest" ); | |
} | |
// ... |
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
function aroundHandler( event, targetAction, eventArguments, rc, prc ) { | |
try { | |
// prepare arguments for action call | |
var args = { | |
event = arguments.event, | |
rc = arguments.rc, | |
prc = arguments.prc | |
}; |
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
/** | |
* Parses API Document $extend notations recursively | |
* | |
* @param APIDoc The struct representation of the API Document | |
* @param [XPath] The XPath to zoom the parsed document to during recursion | |
**/ | |
public function parseDocumentInheritance( required any DocItem ){ | |
if( isArray( DocItem ) ) { | |
for( var i = 1; i <= arrayLen( DocItem ); i++){ |
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
/** | |
* Extends schema definitions based on the passed array of schema objects | |
* Note: Ignores CFML objects (non-structs) because sometimes the parser gets passed in here for some reason | |
* | |
* @objects | |
*/ | |
function extendObject( array objects ) { | |
var output = { | |
"type": "object" | |
}; |
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
// default center position | |
var pos = {lat: 37.751918, lng: -122.450249}; | |
if (navigator.geolocation) { | |
var options = { | |
//enableHighAccuracy: false, | |
timeout: 30000, // 30 seconds | |
maximumAge: 600000 // 10 minutes | |
}; |
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
/** | |
* Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp | |
* www.ortussolutions.com | |
* --- | |
* | |
* I am a cool cool DSN Store for CacheBox. I use the DSN set up in Application.cfc. | |
* Derived from the JDBCStore which comes with Coldbox/Cachebox | |
* You may create the table first with the following columns | |
* | |
* id - varchar(100) PK |
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> | |
/* | |
Hashify | |
http://brianflove.com/2015/02/24/hash-any-coldfusion-type/ | |
*/ | |
private string function hashify(required any value) { | |
//return an empty string for null | |
if (IsNull(arguments.value)) { |
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> | |
/* | |
COMPONENT UTILITIES | |
This component houses frequently used functions for things like | |
exporting a DTO from a component. | |
hashing component properties, etc. | |
*/ | |
/* | |
GET COMPONENT PROPERTY HASH |
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 | |
hint="I am the base class for all entities" | |
{ | |
property name="dateCreated" type="any" getter="true" setter="false"; // think of this like date first persisted | |
property name="dateModified" type="any" getter="true" setter="false"; // think of this like date last persisted | |
property name="createdBy" type="numeric" getter="true" setter="false"; // first persisted by | |
property name="modifiedBy" type="numeric" getter="true" setter="false"; // last persisted by | |
/* |