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
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active March 17, 2025 06:52
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 30, 2025 22:04
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@stevewithington
stevewithington / dspCustomNavWithChildren.cfm
Last active July 19, 2019 07:28
Mura CMS : display a custom navigation based on a content collection/local index and include children up to a specific depth level.
<cfset feed = $.getBean('feed').loadBy(name='Your Feed Name')>
<cfset it = feed.getIterator()>
<cfif it.hasNext()>
<ul class="nav nav-list">
<li class="nav-header">Your Nav Header</li>
<cfloop condition="it.hasNext()">
<cfset item = it.next()>
<li<cfif $.content('contentid') eq item.getContentID()> class="active current"</cfif>>
<a href="#item.getURL()#">#HTMLEditFormat(item.getMenuTitle())#</a>
<!--- This is where you can specify how deep you want to go --->
@scottjehl
scottjehl / fonts.js
Created April 17, 2013 19:04
current font loading snippet
...
// test for font-face version to load via Data URI'd CSS
// Basically, load WOFF unless it's android's default browser, which needs TTF, or ie8-, which needs eot
var fonts = ns.files.css.fontsWOFF,
ua = win.navigator.userAgent;
// android webkit browser, non-chrome
if( ua.indexOf( "Android" ) > -1 && ua.indexOf( "like Gecko" ) > -1 && ua.indexOf( "Chrome" ) === -1 ){
fonts = ns.files.css.fontsTTF;
}
@joyrexus
joyrexus / jq_vs_js.md
Last active April 12, 2025 09:10
Comparison of jQuery and vanilla JS for basic DOM manipulation.

jQuery vs native JS

Selecting Elements

var divs = $("div");

var divs = document.querySelectorAll("div");
@stevewithington
stevewithington / muraDynamicLayoutTemplate.cfc
Last active April 27, 2018 19:24
Mura CMS: dynamically change layout templates (e.g., Allow for a "View As PDF" link, or only open children of a calendar in a blank.cfm layout template ... this way you could open it in a modal window using shadowboxjs, etc.)
component extends='mura.cfobject' {
// drop this in your site or theme eventHandler.cfc
public any function onRenderStart($) {
// allow for a 'View As PDF' link (e.g., <a href="./?viewAsPDF=1">View As PDF</a>)
if ( IsBoolean(arguments.$.event('viewAsPDF')) && arguments.$.event('viewAsPDF') ) {
arguments.$.content('template', 'pdf.cfm');
}
@stevewithington
stevewithington / muraRandomRelatedContent.cfm
Last active September 11, 2020 11:20
Mura CMS: a "Related Content" iterator and query/recordset sorted randomly
<cfscript>
listSortBy = 'menutitle,title,lastupdate,releasedate,orderno,displaystart,displaystop,created,credits,type,subtype';
listSortDir = 'asc,desc';
sortby = ListGetAt(listSortBy, RandRange(1, ListLen(listSortBy), 'SHA1PRNG'));
sortdir = ListGetAt(listSortDir, RandRange(1, ListLen(listSortDir), 'SHA1PRNG'));
rsRelated = $.content().getRelatedContentQuery(sortby=sortby, sortDirection=sortdir);
itRelated = $.getBean('contentIterator').setQuery(rsRelated);
</cfscript>
<!---