Skip to content

Instantly share code, notes, and snippets.

@ryanguill
ryanguill / acf-object-save-arguments-struct-bug.cfm
Created March 9, 2016 20:50
cannot save the arguments struct directly.
<cfscript>
function foo (one, two) {
writedump(objectSave(duplicate(arguments)));
try {
writedump(objectsave(arguments));
} catch (any e) {
writedump(e);
}
}
<cffunction name="setMinimumRequestTimeout" access="private" returntype="void" output="false">
<cfargument name="timeout" type="numeric" required="true" />
<cfscript>
var currentTimeout = 0;
try {
var requestMon = createObject("java", "coldfusion.runtime.RequestMonitor");
currentTimeout = requestMon.getRequestTimeout();
} catch (any e) {
//do nothing
alias dps="docker ps -a"
alias dls="docker-machine ls"
alias dup="docker-machine start default && sleep 1 && denv"
alias ddown="docker-machine stop default"
alias dstart="denv && docker-compose up -d && dlogs"
alias drestart="denv && docker-compose restart && dlogs"
alias drestartapp="denv && docker-compose restart cf && dlogs"
alias dstop="denv && docker-compose stop && docker-compose rm -f"
alias denv='eval "$(docker-machine env default)"'
alias dexpose='docker-machine ssh default -vnNTL $(ipconfig getifaddr en0):9100:localhost:9100 -L $(ipconfig getifaddr en0):9101:localhost:9101'
DECLARE @name VARCHAR(50) -- database name
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @fileName VARCHAR(256) -- filename for backup
DECLARE @fileDate VARCHAR(20) -- used for file name
-- specify database backup directory
SET @path = 'C:\DBBackups\'
# OS X
.DS_Store*
Icon?
._*
# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
@ryanguill
ryanguill / a.cfc
Last active January 12, 2016 18:17
lucee arguments copied to variables scope?
component {
function publicFunct (one) {
f(one);
}
function f (one, two=2) {
var anonF = function () {
writedump(var=variables, label="f() variables", expand=false); //no key for "one" or "two"
<cffunction name="translateCfSqlType" access="public" returntype="string" output="false">
<cfargument name="typeName" type="string" required="true" />
<cfswitch expression="#arguments.typeName#">
<cfcase value="bigint,int8,serial8">
<cfreturn "cf_sql_bigint" />
</cfcase>
<cfcase value="bigint identity">
<cfreturn "cf_sql_bigint" />
</cfcase>
@ryanguill
ryanguill / a.cfc
Last active October 24, 2015 22:48
component accessors="true" {
property numeric foo setter="false";
/*
Invalid definition for Property.
Property must be defined first within component declaration.
*/
}
<cfscript>
function kthPercentile (k, data) {
if (k > 1) { //this allows users to pass in .99 or 99
k = k / 100;
}
arraySort(data, "numeric");
var kth = k * arrayLen(data);
if (kth == ceiling(kth)) { //its a whole number
return data[kth];
} else {
<cfcomponent>
<cffunction name="getQRCodeURL" access="remote" returntype="string" output="false">
<cfargument name="data" type="string" required="true" />
<cfargument name="size" type="numeric" required="true" />
<cfset var baseURL = "https://chart.googleapis.com/chart?cht=qr" />
<cfreturn baseURL & "&chs=" & arguments.size & "x" & arguments.size & "&choe=UTF-8&chld=H|1&chl=" & urlencodedFormat(arguments.data,"UTF-8") />
</cffunction>