Skip to content

Instantly share code, notes, and snippets.

Chris Weller wellercs

Block or report user

Report or block wellercs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wellercs
wellercs / javaloader-elasticsearch-ClassNotFoundException
Last active Jan 30, 2016
elastic search class not found exception using JavaLoader
View javaloader-elasticsearch-ClassNotFoundException
java.lang.ClassNotFoundException: org.elasticsearch.common.settings.ImmutableSettings at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.ClassLoader.findSystemClass(ClassLoader.java:1059) at com.compoundtheory.classloader.NetworkClassLoader.loadClass(NetworkClassLoader.java:488) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at coldfusion.runtime
View cfml-REReplace-\1
<cfscript>
REReplaceNoCase("{{cms:winter_wonderland}}", "{{cms:(\w+)}}", "#getThemeData(theme='\1')#", "all");
function getThemeData(required string theme) {
writedump(arguments);
}
</cfscript>
@wellercs
wellercs / cfml-append-vs-addAll
Created Dec 3, 2015
CFML - array append versus addAll
View cfml-append-vs-addAll
<cfscript>
arr1 = [1];
arr2 = [2,3];
arr1.append(arr2);
writedump(arr1);
arr3 = [1];
arr4 = [2,3];
arr3.addAll(arr4);
writedump(arr3);
View list-with-consecutive-delimiter
<cfscript>
// testxy gives expected results
testxy.actual_dimensions = "144xy210";
testxy.actual_dimension_width = listFirst(testxy.actual_dimensions, "x", true);
testxy.actual_dimension_height = listLast(testxy.actual_dimensions, "x", true);
writedump(testxy);
// testxx does not give expected results
// expected testxx.actual_dimension_height to be x210
testxx.actual_dimensions = "144xx210";
View api-service
<cfscript>
// inside Application.cfc is service constructor
application.EnterpriseService = new path.to.EnterpriseService();
// inside site code somewhere
application.EnterpriseService.call(api_id=#, custom_args={});
// EnterpriseService.cfc
init() {
// some shared constants set here
View Twitter-cfc
<cfcomponent displayname="Twitter" output="false" hint="I provide functions for interacting with the Twitter API.">
<cfscript>
this.name = "Twitter";
variables.baseURI = "https://api.twitter.com/";
variables.charset = "UTF-8";
variables.version = "1.1";
</cfscript>
<cffunction name="init" access="public" output="false" returntype="any" hint="I initialize the component">
<cfargument name="apiKey" required="false" type="string" default="" hint="I am the API key to the Twitter API that was provided to us by Twitter.">
@wellercs
wellercs / cf_cfqueryparamWithSQLVar
Created Nov 1, 2013
Example of declaring and setting a SQL variable with cfqueryparam since there seems to be performance issues with large data sets when using cfqueryparam in a sub-select.
View cf_cfqueryparamWithSQLVar
<cfset arguments.IsSold = 1>
<cfquery name="local.qryTraditional" datasource="cfartgallery">
SELECT
a1.ArtistID
, a1.FirstName
, a1.LastName
, (
SELECT TOP 1 LargeImage
FROM Art
WHERE IsSold = <cfqueryparam cfsqltype="cf_sql_bit" value="#arguments.IsSold#">
@wellercs
wellercs / Response-cfc-jquery-example
Created Apr 6, 2013
jQuery example of calling a function that consumes Response.cfc
View Response-cfc-jquery-example
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url: '/sandbox/Demo.cfc', // this can be found at https://gist.github.com/wellercs/5327556
data: {
method: 'validateDemo',
fname: "John",
lname: "Doe",
email: "bademail",
@wellercs
wellercs / Response-cfc-example
Created Apr 6, 2013
Example of working with Response.cfc
View Response-cfc-example
<cffunction name="validateDemo" access="public" returntype="any" output="false">
<cfargument name="fname" type="string" required="true">
<cfargument name="lname" type="string" required="true">
<cfargument name="email" type="string" required="true">
<cfargument name="throwerror" type="boolean" required="false" default="false">
<cfset var local = {}>
<cftry>
<cfset local.responseobject = new Response()>
View cfchart_invalid_color.cfm
<cfchart format="png" chartwidth="270" xaxistitle="Visits last 7 Days" show3d="no" foregroundcolor="##333333" showborder="no" fontbold="yes" tipStyle="none" url="" showLegend="true">
<cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="FLASHvisits" datalabelstyle="none" seriesLabel="FloorPlan">
<cfif chartData.showVTS><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="VTSvisits" seriesColor="blue" datalabelstyle="none" seriesLabel="IDS"></cfif>
<cfif chartData.showMobile><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="MOBILEvisits" seriesColor="red" datalabelstyle="none" seriesLabel="Mobile"></cfif>
</cfchart>
<!---
The line that the stack trace says it's erroring on is:
<cfif chartData.showMobile><cfchartseries type="line" query="chartData" itemcolumn="dateRange" valuecolumn="MOBILEvisits" seriesColor="red" datalabelstyle="none" seriesLabel="Mobile"></cfif>
--->
You can’t perform that action at this time.