Skip to content

Instantly share code, notes, and snippets.

View JamoCA's full-sized avatar

James Moberg JamoCA

View GitHub Profile
@JamoCA
JamoCA / Pikaday_datejs.js
Created October 9, 2013 01:01
Modifications made to Pikaday (date 10/8/2013 - https://github.com/dbushell/Pikaday) to make it compatible with DateJS 1.0 Alpha-1 (https://github.com/datejs/Datejs) due to Date.js usurping Date.parse().
/*!
* Pikaday
*
* Copyright © 2013 David Bushell | BSD & MIT license | https://github.com/dbushell/Pikaday
*/
(function (root, factory)
{
'use strict';
@JamoCA
JamoCA / Pikaday_DateJS_Demo.htm
Last active March 8, 2019 15:28
Quick demo of Pikaday working with Date.js. Enter "tomorrow" or "next year" or "12/25" into the date field and Date.js takes over to ensure that the value is a valid date.
<!DOCTYPE html>
<html>
<head>
<title>Pikaday - jQuery + Date.js Example</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://dbushell.github.io/Pikaday/css/pikaday.css">
<script src="https://dbushell.github.io/Pikaday/pikaday.js"></script>
<script src="https://dbushell.github.io/Pikaday/plugins/pikaday.jquery.js"></script>
@JamoCA
JamoCA / isCyrillic.cfm
Last active March 8, 2024 01:37
This is a ColdFusion UDF to determine if a text string contains any Cyrillic characters. (Returns boolean Yes/No.) The ColdFusion 9 & 10 Regex function doesn't support UTF, so you need to access Java in order to do it.
<cfscript>
function isCyrillic(input){
return javaCast("string", input).matches("(.*)[\u0400-\u04FF](.*)");
/* Prior method that was used. Slower.
return createObject("java", "java.util.regex.Pattern").compile(javaCast("string", "[\u0400-\u04FF]")).matcher(javaCast("string", input)).find();
*/
}
</cfscript>
@JamoCA
JamoCA / CFLoop_Test.cfm
Last active December 26, 2015 19:59
ColdFusion looping comparison script - CFScript versus CFML. Based on information available at http://duncan99.wordpress.com/2012/10/18/coldfusion-cfloop-versus-cfscript-for-loop-performance/ I tested this because some functions seemed slower when migrating CFML to CFScript.
<!DOCTYPE html>
<html lang="en">
<head>
<title>CFLoop Test - CFScript versus CFML</title>
</head>
<body>
<h1>CFLoop Test - CFScript versus CFML</h1>
<cfset testresults = arraynew(2)>
<cfset myarray = arraynew(1)>
@JamoCA
JamoCA / clickDiv_jQuery.htm
Last active September 4, 2019 13:32
ClickDiv - Use jQuery to turn any container into an identifiable hotlink that performs a "click" on the first A element.
<!DOCTYPE html>
<html lang="en">
<head>
<title>clickDiv</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js"></script>
<script>
$(function(){
if ($('.clickDiv').has('a').length){
$('.clickDiv').has('a').css('cursor','pointer');
}
@JamoCA
JamoCA / ColdFusion_DateFormats.cfm
Last active December 29, 2015 04:49
ColdFusion isDate, DateFormat, LSDateFormat & Date.JS Test - Comparing server-side ColdFusion isDate(), DateFormat() and LSDateFormat() to determine which dates can be parsed. (Added an open-source JavaScript Date Library, Date.JS, from 2007 to determine if it was actually possible to parse strings as dates.)
<!DOCTYPE html>
<html lang="en">
<head>
<script src="//cdnjs.cloudflare.com/ajax/libs/datejs/1.0/date.min.js" type="text/javascript"></script>
<title>ColdFusion isDate, DateFormat, LSDateFormat & Date.JS Test</title>
</head>
<body>
<h1>ColdFusion isDate, DateFormat, LSDateFormat & Date.JS Test</h1>
@JamoCA
JamoCA / CF_TrimBug.cfm
Last active December 31, 2015 12:59
Code to demonstrate ColdFusion 10 bug. When using trim inside of a cfquery, but not as part of the query, all single apostrophes are duplicated into two. Adobe has flagged this bug as "NeverFix" and "NotWorthEffort".
<!--- Reported July 2013. Marked by Adobe as "NotWorthEffort".
Try it here http://www.trycf.com/gist/7989967
Railo.Lucee both function correctly. Adobe ColdFusion 10.0.15 does not.
--->
<h1>Trim() Adds Doubles Apostrophes in CFQuery</h1>
<p><a href="https://bugbase.adobe.com/index.cfm?event=bug&amp;id=3585643" target="_blank">https://bugbase.adobe.com/index.cfm?event=bug&amp;id=3585643</a></p>
<p>Please test this code using your ColdFusion server or <a href="http://cflive.net/" target="_blank">CFLive (CF &amp; Railo)</a>
or <a href="http://www.trycf.com/scratch-pad/gist/7989967" target="_blank">TryCF.com</a></p>
@JamoCA
JamoCA / validate_TaxID.js
Created December 27, 2013 17:32
jQuery Validation rule for EIN Tax ID or Social Security Number (SSN) http://jqueryvalidation.org/
jQuery.validator.addMethod("taxid", function(value, element) {
return this.optional(element) || /^(\d{3})-?\d{2}-?\d{4}$/i.test(value) || /^(\d{2})-?\d{7}$/i.test(value)
}, "Invalid Tax ID");
@JamoCA
JamoCA / noLastPassStyle.css
Created February 7, 2014 17:10
CSS to suppress LastPass INPUT styling
// I like LastPass, but the input field styling on repetitive admin forms is distracting and unnecessary.
// This resets the background image, padding and hides the inset LastPass button. (No visible button, but still clickable.)
// <input type="password" name="Password" class="noLastPassStyle">
input.noLastPassStyle {
background-image:none !important;
background-attachment:none !important;
padding-right:0 !important;
border:1px solid #ABADB3 !important;
}
@JamoCA
JamoCA / dump2.cfm
Last active August 29, 2015 13:56
ColdFusion Custom Tag to allow all params to be safely passed regardless of ColdFusion version. Also removes comments & compresses whitespace.
<cfif thisTag.executionMode neq "start"><cfexit method="exitTag"></cfif><cfsetting enablecfoutputonly="YES">
<!--- Server-based optimization technologies (like Google PageSpeed) may minify
or rewrite the HTML/JS/CSS and break CFDump's output.
Defaults for optional attributes, taken from the docs
http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_d-e_08.html --->
<cfparam name="attributes.var" default="">
<cfparam name="attributes.output" default="browser">
<cfparam name="attributes.format" default="html">
<cfparam name="attributes.abort" default="false">
<cfparam name="attributes.label" default="">