This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A. Acoustic "event" tracking | |
This is used to update the DOM of a button or link with an Acoustic web tracking click event. | |
This script uses the url of a button/link to target and tag it. Each object in the "matches" array represents a url that will be tracked with a particular "nameValue" and "typeValue". This script will tag all buttons/links that have a substring that matches the "urlfragment" value. | |
If you want to track multiple buttons or links, create an object for each unique url. | |
- urlfragment: part of a button/link url that will uniquely match only the button/link that you want to track. | |
- nameValue: a string provided by Digital Marketing than Acoustic will use to track the web event. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Events bubble by default. So the difference between the two is: | |
target is the element that triggered the event (e.g., the user clicked on) | |
currentTarget is the element that the event listener is attached to. | |
source: https://stackoverflow.com/a/10086501/1735394 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
See link above. Trying a goofy way to attach comments to a generic page. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span id="cdate"></span><script>document.getElementById("cdate").innerHTML = (new Date().getFullYear());</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// early in the head as possible | |
var observer = new MutationObserver(function(mutations){ | |
for (var i=0; i < mutations.length; i++){ | |
for (var j=0; j < mutations[i].addedNodes.length; j++){ | |
checkNode(mutations[i].addedNodes[j]); | |
} | |
} | |
}); | |
observer.observe(document.documentElement, { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sestAttrib(el_id, el_attr, el_value){ | |
if (document.getElementById(el_id)){ // if element exists | |
document.getElementById(el_id)[el_attr] = el_value; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
// test at https://dotnetfiddle.net/ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
Console.WriteLine("List practice"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm i gulp -D | |
npm i browser-sync -D | |
npm i gulp-sass -D | |
// favicon fix for index.html | |
<link rel="icon" href="data:;base64,iVBORw0KGgo="> | |
touch gulpfile.js | |
// This gulpfiles expect a 'dist' and 'src' folder (for easy ftp, less easy for github pages) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// converting nodelist to an array...for ie11: | |
// ie11 won't like [...nodelist] or Array.from(nodelist) so use: | |
let elements = Array.prototype.slice.call(document.querySelectorAll('.things')); | |
// looping through the array....for ie11: | |
// ie11 won't like elements.map() so use: | |
elements.forEach(function(el) { | |
console.log('el:', el); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Be amazed at this use for destructuring | |
* If you pass args as an obj instead of | |
* distinct values like f('red','male',23) | |
* You can use destructuring in the function | |
* to get what you want without needing to | |
* figure out which position it should be in! | |
*/ | |
function f( {name, age} = {}){ // destructure the received {} to name and age. | |
console.log('age:',age); // age: 23 |
NewerOlder