Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
aliaspooryorik / assetService.cfc
Last active September 10, 2018 17:53 — forked from cfvonner/assetService.cfc
Testing a service with dependencies
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 } );
The html...
<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<h3>Submit Some Hidden Form Data</h3>
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
@aliaspooryorik
aliaspooryorik / operators.cfm
Created April 10, 2016 16:56 — forked from anonymous/operators.cfm
CFML operators
<cfscript>
function operatorTest(a, b) {
var result = {
"#a# || #b#": a || b,
"#a# && #b#": a && b,
"#a# XOR #b#": a XOR b,
"#a# IMP #b#": a IMP b,
"#a# ? #b# : false": a ? b : true,
"#a# EQV #b#": a EQV b,
"#a# == #b#": a == b
// ORMSettings: flushatrequestend = false, automanagesession = false
// No errors, just obj.myprop not populate to db:
obj = cacheget(tag);
entityMerge(obj);
transaction {
obj.myprop = 'example';
}
@aliaspooryorik
aliaspooryorik / trycf-gist.cfm
Last active August 29, 2015 14:23 — forked from anonymous/trycf-gist.cfm
LSDateFormat error
<cfscript>
foo = "{ts '2015-01-09 15:15:39'}";
writeDump(isDate(foo)); // true
writeDump(DateFormat(foo, "yyyy-mm-dd")); // 2015-01-09
writeDump(LSDateFormat(foo, "yyyy-mm-dd")); // error
</cfscript>
@aliaspooryorik
aliaspooryorik / gist:2788073
Created May 25, 2012 13:14 — forked from richardherbert/gist:2787971
ColdBox FormUtilities Interceptor
<!---
LICENSE
Copyright 2007 Brian Kotek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@aliaspooryorik
aliaspooryorik / gist:2225898
Created March 28, 2012 12:55
Displaying document width with jQuery
// fire event when window is resized
$( window ).resize( function() {
$body = $( 'body' );
$documentWidth = $( '#document-width' );
if ($documentWidth.length===0){
$documentWidth = $( '<p id="document-width" />' );
$body.prepend( $documentWidth );
}
$documentWidth.text( $body.width() );