Skip to content

Instantly share code, notes, and snippets.

@gregstewart
gregstewart / gist:866034
Created March 11, 2011 15:36
Function to merge an array of PDF documents into one and another function to stamp a PDF document onto another
<cffunction name="mergePDFs" access="public" output="false" returntype="binary" hint="">
<cfargument name="pdfs" type="array" required="true" />
<cfset var document = "" />
<!--- // temp PDF file to be written to --->
<cfset var fileOut = ExpandPath("./" & createUUID() & ".pdf") />
<cfset var fileIO = "" />
<cfset var writer = "" />
<cfset var cb = "" />
<cfset var pdf = 0 />
@gregstewart
gregstewart / gist:2484154
Created April 24, 2012 21:53
Launch Chrome with paint rectangles visible and remote debugger
/Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --show-paint-rects --remote-debugging-port=9222
@gregstewart
gregstewart / gist:2767657
Created May 22, 2012 08:43
Global Namespace checker - simplified (for Jasmine)
_global_namespace_things = [];
var _captured_global_namespace = this;
for (var prop in _captured_global_namespace) {
_global_namespace_things.push(prop);
}
@gregstewart
gregstewart / gist:2767666
Created May 22, 2012 08:46
Turn off jQuery animations (for Jasmine)
$.fx.off = true;
@gregstewart
gregstewart / gist:2767675
Created May 22, 2012 08:48
zepto.selector.js
;(function($){
var zepto = $.zepto, oldQsa = zepto.qsa, oldMatches = zepto.matches
function visible(elem){
elem = $(elem)
return !!(elem.width() || elem.height()) && elem.css("display") !== "none"
}
// Implements a subset from:
// http://api.jquery.com/category/selectors/jquery-selector-extensions/
@gregstewart
gregstewart / hideaddrbar.js
Created September 4, 2012 11:48 — forked from scottjehl/hideaddrbar.js
Normalized hide address bar for iOS & Android
/*
* Normalized hide address bar for iOS & Android
* (c) Scott Jehl, scottjehl.com
* MIT License
*/
(function( win ){
var doc = win.document;
// If there's a hash, or addEventListener is undefined, stop here
if( !location.hash && win.addEventListener ){
@gregstewart
gregstewart / gist:4124152
Created November 21, 2012 10:27
Global namespace checker spec file
describe("our use of global namespace", function () {
var in_array = function (value, array) {
return ($.inArray(value, array) !== -1);
};
var global_namespace_provenance = function (thing) {
var previous_global_things = _global_namespace_things;
if (in_array(thing, previous_global_things)) {
return "existed in global before: " + thing;
@gregstewart
gregstewart / inner outer border radius button
Created February 22, 2013 11:52
Basic css button with an exterior and interior rounded border
.button {
display: inline-block;
@include border-radius(1.5em);
padding: 0.25em 2em;
margin: 0.25em 0;
font: {
weight: normal;
size: 100%;
family: $brand-face-bold;
}
@gregstewart
gregstewart / gist:a2ea45d7ca35d424d83e
Created June 2, 2014 09:19
Git store and unset credentials snippet
# store credentials
git config credential.helper store
# unset storing of credentials
git config --unset credential.helper
@gregstewart
gregstewart / plato.js
Created August 21, 2014 10:10
configuration for grunt-plato task
(function (module) {
'use strict';
var config = {
plato: {
options : {
exclude: /assets\/.+/
},
files: {
'reports/plato': ['src/**/*.js', 'test/**/*.js']