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 |
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
php -S 127.0.0.1:8080 |
NewerOlder