Skip to content

Instantly share code, notes, and snippets.

View christierney402's full-sized avatar

Chris Tierney christierney402

View GitHub Profile
@christierney402
christierney402 / ComplexIdentityID.sql
Last active December 14, 2015 22:29
TSQL: Return Identity ID using complex UPDATE / INSERT statements #snippet
DECLARE @T TABLE (
cartID INT NOT NULL
)
UPDATE
UserCart
SET
dateModified = GETDATE(),
isGift = 1
OUTPUT
@christierney402
christierney402 / GoogleCDNjQuery.htm
Last active December 15, 2015 23:20
JS: Google CDN hosted jQuery Base and jQuery UI with local backup #snippet
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/themes/overcast/jquery-ui.min.css">
<!--- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline --->
<!--- Load the full jQuery version (ex 1.9.1 not 1.9) so it cached --->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="/js/jquery-1.9.1.min.js"><\/script>');
</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
@christierney402
christierney402 / DI1Application.cfc
Last active December 15, 2015 23:28
CF: Application.cfc Example With DI/1 #snippet
component {
this.name = hash( getCurrentTemplatePath() );
// Do not use datasource attribute in cfquery
this.datasource = "myDSN";
this.sessionManagement = true;
/**
* /model/beans/ contains transient CFC's
* All others are singleton CFC's
@christierney402
christierney402 / jQuerySelfInvokingAnonymousFunctionTemplate.js
Last active December 15, 2015 23:29
JS: jQuery Self-Invoking Anonymous Function Template #snippet
/*global $:false, jQuery:false */
(function($) {
"use strict";
$(document).ready(function() {
/* js code here */
});
})(jQuery);
@christierney402
christierney402 / Application.cfc
Last active January 4, 2021 10:51
CF: Using "Access-Control-Allow-Origin" header in ColdFusion CFScript #snippet
component {
boolean function onRequestStart( required string targetPage ) {
var headers = getHttpRequestData().headers;
var origin = '';
var PC = getpagecontext().getresponse();
// Find the Origin of the request
if( structKeyExists( headers, 'Origin' ) ) {
@christierney402
christierney402 / Preferences.sublime-settings.json
Last active December 16, 2015 14:09
CFG: Sample Sublime Text 2 settings files that I use
{
"color_scheme": "Packages/User/Espresso Soda.tmTheme",
"highlight_line": true,
"ignored_packages":
[
"Vintage"
],
"line_padding_bottom": 1,
"line_padding_top": 1,
"soda_classic_tabs": true,
@christierney402
christierney402 / ColdFusionPowerShellSettings.ps1
Created May 1, 2013 21:07
Settings for ColdFusion Server to be started in the Windows PowerShell with custom sizes and colors
$pshost = get-host
$pswindow = $pshost.ui.rawui
$newsize = $pswindow.buffersize
$newsize.height = 3000
$newsize.width = 87
$pswindow.buffersize = $newsize
$newsize = $pswindow.windowsize
$newsize.height = 19
@christierney402
christierney402 / Application Scope Dump.cfm
Created May 2, 2013 16:18
CF: Application Scope Dump #snippet
<cfset pageclass = "allapps">
<cfsetting requesttimeout="1000">
<br>
<cfparam name="url.sessdump" default="false">
<cfset Cfapp_list = createObject("java","coldfusion.runtime.ApplicationScopeTracker")>
<!--- <cfdump var="#CFAPP_list#"> --->
<cfset appIterator = CFAPP_list.getApplicationKeys() />
<cfset oSession = createObject("java","coldfusion.runtime.SessionTracker")>
@christierney402
christierney402 / sortObj.js
Last active January 13, 2021 12:21
JS: Sort a JavaScript object by key in alphabetical order case insensitive. Thanks to Arne Martin Aurlien and Ivan Krechetov for inspiration. #snippet
/**
* Sort JavaScript Object
* CF Webtools : Chris Tierney
* obj = object to sort
* order = 'asc' or 'desc'
*/
function sortObj( obj, order ) {
"use strict";
var key,
@christierney402
christierney402 / gist:5625001
Last active December 17, 2015 14:29
SQL: Insert if not updated #snippet
UPDATE Table1
SET (...)
WHERE Column1='SomeValue'
IF @@ROWCOUNT=0
INSERT INTO Table1
VALUES (...)