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
// CSS Color Names | |
// Compiled by @bobspace | |
// Updates by @ricealexander | |
// added Rebecca Purple | |
// associates color names with their hex values | |
// random color and locating a color in the array by its name | |
const colorValues = [ | |
{hex: "#F0F8FF", name: "AliceBlue"}, |
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
const query = (selector, source = document) => { | |
if (isElement(selector)) return selector | |
if (typeof selector !== 'string') { | |
throw new TypeError(`First argument must be a string. Instead got ${typeof selector}`) | |
} | |
if (!isElement(source)) { | |
throw new TypeError(`Second argument must be a Node/NodeList. Instead got ${source}`) | |
} |
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
// Inspired by @kokokonotsu | |
/// https://github.com/kokokonotsu/Cells-and-Grids | |
const | |
gridContainer = 'body', // selector for our HTML grid | |
columnCount = 26, // number of columns | |
rowCount = 20; // number of rows | |
// Generate the grid |
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
const detectAdblock = ()=> { | |
const adSample = '<div class="adBanner"> </div>'; | |
document.body.insertAdjacentHTML('beforeend', adSample); | |
const bannerHeight = document.querySelector('.adBanner').offsetHeight; | |
document.querySelector('.adBanner').remove(); | |
return (bannerHeight === 0) ? true : false; | |
} | |
console.log(detectAdblock()); |
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
// Build Custom Stylesheets | |
/// this is a really basic function for adding custom stylesheets | |
/// it works by inserting a style tag into the head | |
/// and then populating styles into it. | |
/// this demo was built with IE support in mind. | |
function Stylesheet(id) { | |
this.sheet = id; | |
document.head.insertAdjacentHTML("beforeend", '<style id="'+ this.sheet +'"></style>'); |
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
:root { | |
--system-sans-serif: | |
system-ui, /* detect system font automatically */ | |
-apple-system, /* Safari (Mac OS X and iOS) and Older Mac OS X */ | |
BlinkMacSystemFont, /* Chrome<56 (Mac OS X) */ | |
"Segoe UI", /* Windows and Windows Phone */ | |
"Roboto", /* Android and Chrome OS */ | |
"Oxygen", /* KDE - Linux environment */ | |
"Ubuntu", /* Ubuntu - Linux distribution */ | |
"Cantarell", /* GNOME - Linux environment */ |
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
.countdown-container { | |
font-size: 1rem; | |
text-align: center; | |
} | |
.countdown-group { | |
display: inline-block; | |
margin: 0 1em; | |
} | |
.countdown-tile { | |
border-bottom: 2px solid; |
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
const arr1 = ["a","b","c"]; | |
const arr2 = ["d","e","f"]; | |
const arr3 = ["g","h","i"]; | |
// Array.prototype.concat() | |
const arrayConcat = arr1.concat(arr2).concat(arr3); | |
// Array.prototype.push() + spread operator | |
const arrayPush = []; |
OlderNewer