Skip to content

Instantly share code, notes, and snippets.

View stphnwlkr's full-sized avatar

Stephen Walker stphnwlkr

View GitHub Profile
<cfif not hasPluginMappings>
<!--- Try and include plugin mappings --->
<cfset canWriteMode=true>
<cfset hasMappings=true>
<cfset canWriteMappings=true>
<cftry>
<cfinclude template="plugins/mappings.cfm">
<cfcatch type="missingInclude">
<cfset hasMappings=false>
</cfcatch>
@stphnwlkr
stphnwlkr / mycal.cfc
Created July 15, 2012 22:58
CFC for my calendar
component {
url.returnformat="json";
remote function getEvents() {
var q = new query();
q.setSQL("select eid, ecatTextColor, eCatColor, etitle, eCatName, estart, eEnd, eAllDay, eDescription from mycal_Events_view");
var dbresults = q.execute().getResult();
@stphnwlkr
stphnwlkr / BarwithRules
Created July 26, 2012 09:18
ZingChart with rule
{
"show-progress":false,
"animate-type":"initial","graphset":[
{
"histogram":true,
"preview":{"position" : "50% 100%","margin" : "10,50,10,50","height" : 50, "handles":{
"border-color":"#000000",
"border-width":1
}},
<cfset d1 = application.nsd.getClosedRequestCountByMonth()>
<cfset d2 = application.nsd.getClosedChangeCountByMonth()>
{
"show-progress":false,"gui":{
"behaviors":[
{"id":"Print",
"enabled":"all", "text":"PRINT"},
{"id":"DownloadPDF","enabled":"none"},
{"id":"ViewSource","enabled":"none"}
<cfchart name="closcounter" width="700" height="500" format="html" style="style.txt" >
<cfchartseries query="d1" valuecolumn="qty" serieslabel="Requests and Incidents" itemcolumn="month" seriescolor="##94bd5a" />
<cfchartseries query="d2" valuecolumn="qty" serieslabel="Change Orders" itemcolumn="month" seriescolor="##39a7c6" />
</cfchart>
@stphnwlkr
stphnwlkr / zc0
Created January 29, 2013 01:18
Implementing ZingChart
<div id="dashChart" style="width:100%; height:500px" class="margin-bottom32">
</div>
<script src="/_media/js/charts/html5_scripts/zingchart-html5-min.js"></script>
//if you have a license
<script src="/_media/js/charts/html5_scripts/license.js"></script>
<script>
window.onload = function(){
@stphnwlkr
stphnwlkr / resize.cfm
Last active December 14, 2015 21:29
Resize existing photos
<cfoutput>
<cfdirectory directory="#expandpath('#application.root#/gallery/photos/raw')#" action="list" name="rawf" filter="*.jpg">
<cfloop query="rawf">
<cfimage action="read" source="#expandpath('#application.root#/gallery/photos/raw/#rawf.name#')#" name="myimage">
<cfset ImageScaleToFit(myimage, 262, "", "highestQuality")>
<!--- resize it small --->
<cfimage action="write" quality="1" source= "#myimage#" destination= "#expandpath('#application.root#/gallery/photos/sml/#rawf.name#')#" overwrite="yes">
@stphnwlkr
stphnwlkr / multiple_resize.cfm
Created March 13, 2013 12:32
Multiple resize operations
<cffile action="upload" destination= "#expandpath('#application.root#/gallery/photos/raw/')#" filefield="newphoto" nameconflict="makeunique">
<cfimage source="#expandpath('#application.root#/gallery/photos/raw/#file.serverfile#')#" name="myimage">
<!--- resize it large --->
<cfset ImageScaleToFit(myimage, 1024, "", "highestQuality")>
<cfimage action="write" quality="1" source= "#myimage#" destination= "#expandpath('#application.root#/gallery/photos/lrg/#file.serverfile#')#" overwrite="yes">
<!--- resize it medium --->
<cfset ImageScaleToFit(myimage, 640, "", "highestQuality")>
<cfimage action="write" width="640" height="480" quality="1" source= "#myimage#" destination= "#expandpath('#application.root#/gallery/photos/med/#file.serverfile#')#" overwrite="yes">
@stphnwlkr
stphnwlkr / gist:6095176
Created July 27, 2013 15:33
CF OnError Function
<cffunction name="onError" returntype="void" output="true">
<cfargument name="exception" required="true">
<cfargument name="eventname" type="string" required="true">
<cfset var errortext = "">
<cflog file="applicationname_errorlog" text="#arguments.exception.message#">
<cfsavecontent variable="errortext">
<cfoutput>
An error occurred: http://#cgi.server_name##cgi.script_name#?#cgi.query_string#<br />
component {
url.returnformat="json";
remote function getEvents() {
var q = new query();
q.setSQL("select eid, ecatTextColor, eCatColor, etitle, eCatName, estart, eEnd, eAllDay, eDescription from mycal_Events_view");
var dbresults = q.execute().getResult();
var results = [];