Skip to content

Instantly share code, notes, and snippets.

View cfmitrah's full-sized avatar
🤓
Looking for new projects

Saravanamuthu Aka CF Mitrah cfmitrah

🤓
Looking for new projects
View GitHub Profile
@cfmitrah
cfmitrah / tinyMCE_clear_browser_cache.cfm
Created May 6, 2014 20:05
tinyMCE browser cache issue in IE10
<!--- Previous code which is not loading plugin icons properly in IE10 --->
<script src="tiny_mce/tiny_mce.js" type="text/javascript"></script>
<!--- Added a random number as a querystring --->
<script src="tiny_mce/tiny_mce.js?key=#randrange(1,1000)#" type="text/javascript"></script>
@cfmitrah
cfmitrah / Enable_third_level_menu_in_MuraCMS_bootstrap_theme.cfm
Created May 6, 2014 20:09
Enabling third level menu in MuraCMS 6 bootstrap theme
<cf_CacheOMatic key="dspPrimaryNav#$.content('contentid')#">
#$.dspPrimaryNav(
viewDepth=2,
id='navPrimary',
class='nav',
displayHome='Never',
closePortals=false,
showCurrentChildrenOnly=false,
ulTopClass='nav',
ulNestedClass='dropdown-menu',
@cfmitrah
cfmitrah / jqueryValidationErrorPlacementSemanticUI.js
Created May 9, 2014 19:24
jQuery validation error placement for Semantic-UI
jQuery(document).ready(function($) {
$.validator.setDefaults({
errorClass: 'errorField',
errorElement: 'div',
errorPlacement: function(error, element) {
error.addClass("ui red pointing above ui label error").appendTo( element.closest('div.field') );
},
highlight: function(element, errorClass, validClass) {
$(element).closest("div.field").addClass("error").removeClass("success");
},
@cfmitrah
cfmitrah / parseAdobeCFDocToc.cfm
Created May 9, 2014 19:50
Parse Adobe ColdFusion Documentation's TOC.xml file
<cfscript>
myxmldoc = XmlParse("#expandpath('.')#/toc.xml");
if(listfirst(server.coldfusion.productversion) gte 10)
selectedElements = XmlSearch(myxmldoc, "//topic[ upper-case(@label) = '#ucase(url.q)#' ]");
else
selectedElements = XmlSearch(myxmldoc, "//topic[ contains(translate(@label, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') ,'#lcase(url.q)#') ]/@href");
</cfscript>
<cfif arrayLen(selectedElements) neq 0>
<cflocation url="#selectedElements[1].XmlAttributes.href#" addtoken="false">
import sublime, sublime_plugin, webbrowser
class LaunchCfHelpCommand(sublime_plugin.TextCommand):
def run(self, edit, forward = True):
word = ""
for s in self.view.sel():
word = self.view.word( s )
''' To use cfquickdocs
s = sublime.load_settings("CfQuickDocs.sublime-settings")
<cfscript>
/* ColdFusion 11 dropped the undocumented cfusion_encrypt & decrypt functions while Railo 4.2 still officially supports it.
This script will reestablish the built-in function. You can also use fusion_encrypt/decrypt (without the "c").
Based on 2005 blog post: http://www.barneyb.com/barneyblog/2005/10/28/cfusion_encryptcfusion_decrypt-udfs/ */
function fusion_binaryXOR(n1, n2){
n1 = formatBaseN(n1, 2);
n2 = formatBaseN(n2, 2);
return inputBaseN(replace(n1 + n2, 2, 0, "all"), 2);
}
function fusion_encrypt(string, key){
@cfmitrah
cfmitrah / config.cfc
Last active January 27, 2017 10:14
Install PresideCMS in Apache without CommandBox
// Reference : https://portal.netfusion.ch/kb/a19/konfiguration-presidecms.aspx
component extends="preside.system.config.Config" output=false {
public void function configure() output=false {
super.configure();
settings.preside_admin_path = "cmsadmin";
settings.system_user = "sysadmin";
settings.default_locale = "en";
@cfmitrah
cfmitrah / canadaPostRating.cfc
Last active July 11, 2017 14:46
MitrahSoft CanadaPost shipping API ColdFusion wrapper
<cfcomponent hint="Canada Post">
<cffunction name="init" access="public">
<cfargument name="apiKey" type="string" required="true" />
<cfargument name="customerNumber" type="string" required="true" />
<cfargument name="contractNumber" type="string" required="true" />
<cfset variables.apiKey = arguments.apiKey>
<cfset variables.customerNumber = arguments.customerNumber>
<cfset variables.contractNumber = arguments.contractNumber>
<cfscript>
clos = function( func ) { func(); };
clos( function(){
clos( function(){
writeDump( foo ?: "I am null" );
} );
} );
</cfscript>
@cfmitrah
cfmitrah / demoDriver.cfc
Last active March 11, 2019 08:20
Demo Lucee Event Gateway - Driver Component
<cfcomponent output="no">
<cfset variables.logFileName = "demoLogGateway" />
<cfset variables.state="stopped" />
<cffunction name="init" access="public" output="no" returntype="void">
<cfargument name="id" required="false" type="string">
<cfargument name="config" required="false" type="struct">
<cfargument name="listener" required="false" type="component">