Skip to content

Instantly share code, notes, and snippets.

@misterdai
misterdai / redstrap.js
Created April 18, 2012 15:04
Bookmarklet that will redesigns Redmine for Twitter Bootstrap. NOT for permanent usage OR as a theme JS file. Only to promote better theme support (http://www.redmine.org/issues/9754) for consideration.
// Bookmarklet to alter Redmine theme to look like twitter bootstrap
// Only a concept to test the design
// Suggest you minify first (removing comments), before bookmarking
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7.2",function($,L){
// BEGIN
$(function() {
$('link[rel=stylesheet]').remove();
$('head')
@misterdai
misterdai / logsessionactivity.cfm
Created February 2, 2012 15:33
Adobe ColdFusion, CFML based file that could be called periodically to log session activity for an application. (AdobeCF only, tested on 8.0.1 should work on 9).
<cfscript>
start = Now();
/*
=== Session Logger ===
== ChangeLog ==
* More config options.
* Supports CREATED, ACCESSED, UPDATED, REMOVED.
* Detects changes in the log keys and redisplays in log if changed.
* Windows newline ending, configurable.
<cfcomponent output="false">
<cffunction name="init" access="public" output="false">
<cfscript>
var local = {};
variables.jObject = CreateObject('java', 'some.java.object.with.set.Methods').init();
variables.methods = {};
local.methods = variables.jObject.getClass().getMethods();
local.len = ArrayLen(local.methods);
@misterdai
misterdai / applicationRestart.cfm
Created July 1, 2010 12:24
Flag the application to run onApplicationStart
<cffunction name="ApplicationRestart" returntype="boolean" output="false">
<cfif IsDefined('application')>
<cftry>
<!--- This is just in case there's no app scope but variables.application --->
<cfset application.setIsInited(false) />
<cfreturn true />
<cfcatch type="any"></cfcatch>
</cftry>
</cfif>
<cfthrow message="No application scope found." />
@misterdai
misterdai / applicationStop.cfm
Created July 1, 2010 12:24
CF7/8 version of ApplicationStop()
<cffunction name="ApplicationStop" returntype="boolean" output="false">
<cfif IsDefined('application')>
<cftry>
<!--- This is just in case there's no app scope but variables.application --->
<cfset CreateObject('java', 'coldfusion.runtime.ApplicationScopeTracker').cleanUp(application) />
<cfreturn true />
<cfcatch type="any"></cfcatch>
</cftry>
</cfif>
<cfreturn false />
@misterdai
misterdai / sessionStop.cfm
Created July 1, 2010 12:22
Stops a Coldfusion session
<cffunction name="sessionStop" output="false">
<cfset var local = StructNew() />
<cfif Not StructKeyExists(application, 'applicationName')>
<cfthrow message="Application.applicationName is missing." />
</cfif>
<cftry>
<cfset local.sid = session.cfid & '_' & session.cftoken />
<cfset local.jTracker = CreateObject('java', 'coldfusion.runtime.SessionTracker') />
<cfset local.jTracker.cleanUp(application.applicationName, local.sid) />
<cfcatch type="any">
@misterdai
misterdai / getUploadData.cfm
Created July 1, 2010 12:20
Retrieves upload information without using CFFile
<cfscript>
function getUploadData() {
var local = {};
local.result = {};
if (cgi.request_method Eq 'post') {
local.uploads = form.getPartsArray();
if (StructKeyExists(local, 'uploads')) {
local.count = ArrayLen(local.uploads);
for (local.u = 1; local.u Lte local.count; local.u++) {
local.info = GetFileInfo(form[local.uploads[local.u].getName()]);