Skip to content

Instantly share code, notes, and snippets.

View richardhughes260's full-sized avatar

Richard Hughes richardhughes260

  • SNA LLC
  • Jupiter, Florida
View GitHub Profile
@richardhughes260
richardhughes260 / gist:3535d4011878325697ab
Last active August 29, 2015 14:14
Write to browser image from cfimage ( AJAX POC )
<cfscript>
//create a 100 x 100 grey background
img = ImageNew("", 100, 100, "rgb", "lightgray");
//create a duplicate of the image
img2 = duplicate( img );
//write in black
imageSetDrawingColor( img2, 'black');
//draw a black circle that is filled
imageDrawOval( img2, 10, 10, 20, 20, true );
//draw a black circle that is filled
@richardhughes260
richardhughes260 / DirectoryList.cfm
Created December 30, 2013 22:18
directoryList Fun :(
<cfscript>
directory='c:/cachedMessages';
variables.dirList=DirectoryList(directory,false,'query','*.eml','desc:DATELASTMODIFIED');
myQuery = new Query(); // new query object
myQuery.setDBType("query");
myQuery.setAttributes(sourceQuery=variables.dirList);
myQuery.setAttributes(maxRows=1);
myQuery.setSQL(" select * from sourceQuery order by DATELASTMODIFIED desc"); //set query
qryRes = myQuery.execute(); // execute query
@richardhughes260
richardhughes260 / gist:5527915
Last active December 17, 2015 01:19
Select only records with valid e-mail addresses from a table
<!--- Create a new three-column query, specifying the column data types --->
<cfset myQuery = QueryNew("Name, Email, Time, Advanced", "VarChar, VarChar, Time, Bit")>
<!--- Make two rows in the query --->
<cfset newRow = QueryAddRow(MyQuery, 2)>
<!--- Set the values of the cells in the query --->
<cfset temp = QuerySetCell(myQuery, "Name", "Rich", 1)>
<cfset temp = QuerySetCell(myQuery, "Email", "rich@rich.com", 1)>
<cfset temp = QuerySetCell(myQuery, "Time", "9:15 AM", 1)>
@richardhughes260
richardhughes260 / example.cfm
Created April 1, 2013 22:49
odd behavior with structFindValue & JSON true
<cfsavecontent variable="variables.scString">{"username": "MinerAccount", "rating": "none", "confirmed_nmc_reward": "0.00000000", "send_threshold": "1.00000000", "nmc_send_threshold": "10.00000000", "confirmed_reward": "0.58411453", "workers": {"MinerAccount.sif": {"last_share": 1364237399, "score": "0", "hashrate": 0, "shares": 0, "alive": false}, "MinerAccount.loki": {"last_share": 1317347573, "score": "0", "hashrate": 0, "shares": 0, "alive": false}, "MinerAccount.odin": {"last_share": 1329744778, "score": "0", "hashrate": 0, "shares": 0, "alive": false}, "MinerAccount.dog": {"last_share": 1364850934, "score": "29285.8037", "hashrate": 2040, "shares": 2816, "alive": true}, "MinerAccount.Freyr": {"last_share": 1364440355, "score": "0", "hashrate": 0, "shares": 0, "alive": false}}, "wallet": "REDACTED", "unconfirmed_nmc_reward": "0.00000000", "unconfirmed_reward": "0.19413921", "estimated_reward": "0.00218734", "hashrate": "3094.363"}</cfsavecontent>
<!---
<cfdump var="#variables.scString#">
<cfdump var="#d
@richardhughes260
richardhughes260 / gist:5087455
Last active December 14, 2015 12:38
ColdFusion wrapper for Google Chart API If you want images to come from your site only and not multiple locations, like when you are using https. This will accept a URL Parameter for the text and will output the image. There is no image on the local file system to clean up later.
<cfparam default="This is Text!!! :)" name="url.text">
<cfhttp
method="Get"
url="http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=#url.text#" getAsBinary = "yes" >
<!--- From Ben Nadel --->
<!--- Check to see if we found the image. --->
<cfif (
FindNoCase( "200", cfhttp.Statuscode ) AND
@richardhughes260
richardhughes260 / gist:5087437
Last active December 14, 2015 12:38
CFML Target generator
<cfparam name="url.height" default="700">
<cfparam name="url.colorForeground" default="000000">
<cfparam name="url.colorBackground" default="FFFFFF">
<cfsetting showdebugoutput="false"/>
<cfif structKeyExists(url,"custom")>
<cfscript>
@richardhughes260
richardhughes260 / jquery.myPass-1.1.js
Created October 22, 2012 22:09
My modifications to jquery.myPass-1.0.js
/* ---------------------------------------------------------------------------------------------
* myPass v1.0 - jQuery password-hiding iPhone-Style
*
* Copyright (c) 2009 Oliver Storm, Stefan Huissel( http://www.mysrc.de )
* Feel free to redistribute the script/modify it, as
* long as you leave my infos at the top.
*
*
* Date Thu, 30 Jun 2009
*