Skip to content

Instantly share code, notes, and snippets.

View christierney402's full-sized avatar

Chris Tierney christierney402

View GitHub Profile
@christierney402
christierney402 / web.config
Created May 5, 2016 21:51
Taffy REST Framework IIS Rewrite Rule
<?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>
@christierney402
christierney402 / copyToClipboard.js
Last active November 29, 2017 13:44
HTML5 Copy to Clipboard
// 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);
};
@christierney402
christierney402 / jQueryAnimateDone.js
Created September 30, 2015 22:14
wait for all jQuery animations to complete then make the newly expanded section can be seen in the viewport
$container = $('myElem');
$(":animated").promise().done( function() {
if( $container[0].getBoundingClientRect().top < 50 ) {
$('html,body').animate({scrollTop: $container.offset().top}, 800);
};
});
@christierney402
christierney402 / .htaccess
Created September 24, 2015 20:26
Require https for a specific domain, ignoring other domains that might use the same code base
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]
@christierney402
christierney402 / queryToArray.cfc
Last active September 10, 2015 22:41
ColdFusion 10+ Query to Array of Stucts
// 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);
}
@christierney402
christierney402 / rebuildAllIndexes05-08.sql
Created September 9, 2015 18:28
Rebuild all indexes for a database on MS SQL 2005-2008
-- 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
@christierney402
christierney402 / hideFileInput.htm
Created August 26, 2015 23:08
Use an element to get a file dialog and upload instead of a file input element
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<body>
<style>
input {
@christierney402
christierney402 / S3Wrapper.cfc
Last active February 9, 2019 07:30
Amazon Web Services (AWS) S3 Wrapper for ColdFusion
/**
* 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
*
@christierney402
christierney402 / S3BucketPolicy.js
Created August 18, 2015 21:22
Amazon Web Services (AWS) S3 bucket policy to enforce encryption, SSL and IP access.
{
"Version": "2012-10-17",
"Id": "BucketPolicy1",
"Statement": [
{
"Sid": "DenyUnEncryptedObjectUploads",
"Effect": "Deny",
"Principal": "*",
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::myBucket/*",
@christierney402
christierney402 / Tierney Light.tmTheme
Last active December 17, 2015 15:08
Sublime Text 2 Light Color Scheme "Tierney Light"
<?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>