Skip to content

Instantly share code, notes, and snippets.

@aliaspooryorik
aliaspooryorik / gist:2225898
Created March 28, 2012 12:55
Displaying document width with jQuery
// fire event when window is resized
$( window ).resize( function() {
$body = $( 'body' );
$documentWidth = $( '#document-width' );
if ($documentWidth.length===0){
$documentWidth = $( '<p id="document-width" />' );
$body.prepend( $documentWidth );
}
$documentWidth.text( $body.width() );
@aliaspooryorik
aliaspooryorik / gist:2788073
Created May 25, 2012 13:14 — forked from richardherbert/gist:2787971
ColdBox FormUtilities Interceptor
<!---
LICENSE
Copyright 2007 Brian Kotek
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@aliaspooryorik
aliaspooryorik / whitespace-bleed-finder.cfm
Last active December 30, 2015 11:19
Script to find missing or suspicious output attributes in components
<cfset folder = expandpath("./")>
<cfset warn = []>
<cfset alert = []>
<cfdirectory action="list" directory="#folder#" filter="*.cfc" recurse="true" name="cfcs" type="file">
<cfoutput>
<style>
@aliaspooryorik
aliaspooryorik / gist:7989693
Created December 16, 2013 16:17
Code Coverage Analyzer
<cfsetting enablecfoutputonly="true" requesttimeout="500">
<!--- path to folder where your application is --->
<cfset applicationroot = expandpath("../../../../../../")>
<!--- path to folder where your tests are --->
<cfset testsfolder = expandpath("../../")>
<!--- folders to exclude --->
<cfset exclude = "dev">
<!--- let's search the application first to see what methods are being called --->
@aliaspooryorik
aliaspooryorik / gist:8842005
Created February 6, 2014 10:48
Delete local branches that have been merged into master
git branch --merged | grep -v '^* master$' | grep -v '^ master$' | xargs git branch -d
@aliaspooryorik
aliaspooryorik / gist:9482602
Created March 11, 2014 09:47
Callback with arguments example
variables.CUT.$("sayHello").$callback(variables.testFunction);
assertEquals("Hola Luis", variables.CUT.sayHello("Luis"))
// the callback method
private function testFunction(name){
return "Hola " & arguments.name;
}
<cfset URL.id = 123>
<cffunction name="testa">
<cfargument name="id" type="numeric" required="no">
<cfreturn isDefined("id")>
</cffunction>
<cffunction name="testb">
<cfargument name="id" type="numeric" required="no">
component extends="testbox.system.BaseSpec" {
function beforeTests(){
cut = fooTest();
}
function run( testResults, testBox ){
describe("A spec", function() {
beforeEach(function(string currentSpec) {
<cfoutput>
#numberformat(4.50, "_.__")#<br>
#numberformat(4.50, "9.99")#<br>
#numberformat(4.50, "0.00")#<br>
#numberformat("4.50", "_.__")#<br>
#numberformat("4.50", "9.99")#<br>
#numberformat("4.50", "0.00")#<br>
#numberformat("4.5", "_.__")#<br>
#numberformat("4.5", "9.99")#<br>
#numberformat("4.5", "0.00")#<br>
@aliaspooryorik
aliaspooryorik / gist:31ec782d04daa90dfef5
Last active August 29, 2015 14:19
listFind alternatives
<cfscript>
// create a dummy list....
list = "";
elements = 5000;
step = 5;
i = 0;
while (i<elements) {
list = listAppend(list, elements + i);