Skip to content

Instantly share code, notes, and snippets.


Chris Tierney CFJSGeek

View GitHub Profile
CFJSGeek / web.config
Created May 5, 2016
Taffy REST Framework IIS Rewrite Rule
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<rule name="api" stopProcessing="true">
<match url="^API/(.+.*)$" ignoreCase="true" />
<add input="{PATH_INFO}" pattern="^.*/index.cfm.*$" negate="true" />
CFJSGeek / copyToClipboard.js
Last active Nov 29, 2017
HTML5 Copy to Clipboard
View copyToClipboard.js
// Remove copy button if copy to clipboard method is not allowed
// Note: Button detection is broken before Chrome 48
var copyBtn = document.querySelector('.copyToClip');
if (copyBtn !== null) {
if( !document.queryCommandSupported('copy') ) {
CFJSGeek / jQueryAnimateDone.js
Created Sep 30, 2015
wait for all jQuery animations to complete then make the newly expanded section can be seen in the viewport
View jQueryAnimateDone.js
$container = $('myElem');
$(":animated").promise().done( function() {
if( $container[0].getBoundingClientRect().top < 50 ) {
$('html,body').animate({scrollTop: $container.offset().top}, 800);
CFJSGeek / .htaccess
Created Sep 24, 2015
Require https for a specific domain, ignoring other domains that might use the same code base
View .htaccess
RewriteEngine on
RewriteBase /
#----- REQUIRE HTTPS for -----
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [NC]
RewriteCond %{HTTPS} !on
RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]
CFJSGeek / queryToArray.cfc
Last active Sep 10, 2015
ColdFusion 10+ Query to Array of Stucts
View queryToArray.cfc
// convert a query to an array of structs
// credit:
function queryToArray( required query query ){
var queryAsArray = [];
for (var row in query){
arrayAppend( queryAsArray, row );
CFJSGeek / rebuildAllIndexes05-08.sql
Created Sep 9, 2015
Rebuild all indexes for a database on MS SQL 2005-2008
View rebuildAllIndexes05-08.sql
-- credit:
DECLARE @fillfactor INT
SET @fillfactor = 80
SELECT OBJECT_SCHEMA_NAME([object_id])+'.'+name AS TableName
FROM sys.tables
OPEN TableCursor
CFJSGeek / hideFileInput.htm
Created Aug 26, 2015
Use an element to get a file dialog and upload instead of a file input element
View hideFileInput.htm
<!DOCTYPE html>
<script src="//"></script>
input {
CFJSGeek / S3Wrapper.cfc
Last active Feb 9, 2019
Amazon Web Services (AWS) S3 Wrapper for ColdFusion
View S3Wrapper.cfc
* Amazon S3 REST Wrapper
* Version Date: 2015-09-03
* Copyright 2015 CF Webtools |
* 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
CFJSGeek / S3BucketPolicy.js
Created Aug 18, 2015
Amazon Web Services (AWS) S3 bucket policy to enforce encryption, SSL and IP access.
View S3BucketPolicy.js
"Version": "2012-10-17",
"Id": "BucketPolicy1",
"Statement": [
"Sid": "DenyUnEncryptedObjectUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::myBucket/*",
CFJSGeek / Tierney Light.tmTheme
Last active Dec 17, 2015
Sublime Text 2 Light Color Scheme "Tierney Light"
View Tierney Light.tmTheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: -->
<!-- code: -->
<plist version="1.0">
<string>Tierney Light</string>