Skip to content

Instantly share code, notes, and snippets.

View dgibson666's full-sized avatar
🏠
Working from home

Doug Gibson dgibson666

🏠
Working from home
View GitHub Profile
@dgibson666
dgibson666 / table_508_simple.html
Last active January 23, 2019 17:32
Basic Accessible Table Markup
<!-- Summary is deprecated -->
<div class="table-responsive">
<table id="tableid" aria-describedby="captionid">
<caption id="captionid" role="alert" aria-live="polite">[Data] sorted by [column header]</caption>
<colgroup>
<col />
<col />
</colgroup>
<col />
<col />
<!--- Style and implementation from http://webaim.org/techniques/skipnav/ --->
<style>
#skipnav a {
padding:6px;
position: absolute;
top:-40px;
left:0px;
color:white;
border-right:1px solid white;
border-bottom:1px solid white;
@dgibson666
dgibson666 / targetfade.css
Created July 18, 2014 21:54
Target Fade CSS
/*
Quick fade on target to attract user attention
http://snook.ca/archives/html_and_css/yellow-fade-technique-css-animations
*/
:target {
-webkit-animation: target-fade 3s 1;
-moz-animation: target-fade 3s 1;
}
@-webkit-keyframes target-fade {
0% { background-color: rgba(255,255,0,1); }
@dgibson666
dgibson666 / skipnav2.html
Created August 15, 2014 20:40
Best Practice Skipnav #2
<!--- Style and implementation from http://webaim.org/techniques/skipnav/ --->
<style>
#skipnav a {
padding:6px;
position: absolute;
top:-40px;
left:0px;
color:white;
border-right:1px solid white;
border-bottom:1px solid white;
@dgibson666
dgibson666 / muraheadersupdate.cfc
Created September 29, 2014 21:51
Mass-Update Mura Headers If Config Changed
<cfscript>
// place this in your Site or Theme eventHandler.cfc, then reload your application!
public any function onApplicationLoad(mo) {
arguments.$.getBean('contentUtility').findAndReplace(
find='h2'
, replace='h3'
, siteid=arguments.$.event('siteid')
);
}
</cfscript>
@dgibson666
dgibson666 / metatags.html
Last active August 29, 2015 14:08
Meta Tags, Including Open Graph and Twitter Card
<!---
Combined Open Graph and Twitter Card Meta Tags
See: https://dev.twitter.com/cards/getting-started
--->
<html prefix="og: http://ogp.me/ns#">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="English" />
<!--- Parse form fields of the same name as an array instead of a list, to avoid issues with commas
more info: http://www.stillnetstudios.com/cf-form-array-comma-workaround/
--->
<cffunction name="FormFieldAsArray" returntype="array" output="false" hint="Returns a Form/URL variable as an array.">
<cfargument name="fieldName" required="true" type="string" hint="Name of the Form or URL field" />
<cfset var tmpPartsArray = Form.getPartsArray() />
<cfset var returnArray = arrayNew(1) />
<cfset var tmpPart = 0 />
<cfset var tmpValueArray = "" >
@dgibson666
dgibson666 / InputTypeDate.cfm
Last active November 18, 2016 15:06
HTML5 Date Inputs
<input type="date" name="inspectionStart" value="#Dateformat(somedate,"yyyy-mm-dd")#">
<script>
$(document).ready(function () {
// If a browser doesn't support HTML5 date input types, then load a backup/polyfill
if(!Modernizr.inputtypes.date){
// Convert the format from the HTML5 dateformat of yyyy-mm-dd to mm/dd/yyyy
$('input[type=date]').each(function(){
var thisdate=$(this).val();
@dgibson666
dgibson666 / createfilename.cfm
Created January 5, 2017 14:44
Create Valid Filename UDF
// CONVERT A STRING TO A VALID FILENAME
function CreateFileName(string){
var str=Trim(string);
// replace invalid filename characters: /\:*?"<>| and whitespaces with underscores
str=ReReplace(str,"[*?\""]","","ALL");
str=ReReplace(str,"\s","_","ALL");
str=ReReplace(str,"[:<>|]","-","ALL");
str=Replace(str,"\","_-_","ALL");
str=Replace(str,"/","_-_","ALL");
// leading period is also invalid for MACs
@dgibson666
dgibson666 / jq_vs_js.md
Created September 24, 2018 16:49 — forked from dgdoblebe/jq_vs_js.md
Comparison of jQuery and vanilla JS for basic DOM manipulation.

jQuery vs native JS

Selecting Elements

var divs = $("div");

var divs = document.querySelectorAll("div");