Skip to content

Instantly share code, notes, and snippets.

Chris Tierney CFJSGeek

View GitHub Profile
@CFJSGeek
CFJSGeek / web.config
Created May 5, 2016
Taffy REST Framework IIS Rewrite Rule
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="api" stopProcessing="true">
<match url="^API/(.+.*)$" ignoreCase="true" />
<conditions>
<add input="{PATH_INFO}" pattern="^.*/index.cfm.*$" negate="true" />
</conditions>
@CFJSGeek
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') ) {
copyBtn.parentNode.removeChild(copyBtn);
};
@CFJSGeek
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
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 www.mysite.com -----
RewriteCond %{HTTP_HOST} ^www\.mysite\.com [NC]
RewriteCond %{HTTPS} !on
RewriteRule ^/?(.*) https://%{HTTP_HOST}%{REQUEST_URI} [R]
@CFJSGeek
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: http://www.bennadel.com/blog/2367-coldfusion-10---looping-over-queries-using-a-for-in-loop-in-cfscript.htm
function queryToArray( required query query ){
var queryAsArray = [];
for (var row in query){
arrayAppend( queryAsArray, row );
}
return(queryAsArray);
}
@CFJSGeek
CFJSGeek / rebuildAllIndexes05-08.sql
Created Sep 9, 2015
Rebuild all indexes for a database on MS SQL 2005-2008
View rebuildAllIndexes05-08.sql
-- credit: http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/
DECLARE @TableName VARCHAR(255)
DECLARE @sql NVARCHAR(500)
DECLARE @fillfactor INT
SET @fillfactor = 80
DECLARE TableCursor CURSOR FOR
SELECT OBJECT_SCHEMA_NAME([object_id])+'.'+name AS TableName
FROM sys.tables
OPEN TableCursor
@CFJSGeek
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>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<style>
input {
@CFJSGeek
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 | cfwebtools.com
*
* 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
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
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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- Generated by: TmTheme-Editor -->
<!-- ============================================ -->
<!-- app: http://tmtheme-editor.herokuapp.com -->
<!-- code: https://github.com/aziz/tmTheme-Editor -->
<plist version="1.0">
<dict>
<key>name</key>
<string>Tierney Light</string>
You can’t perform that action at this time.