This file contains hidden or 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
@charset "UTF-8"; | |
/* Reset box-model and set borders */ | |
/* ============================================ */ | |
*, | |
::before, | |
::after { | |
box-sizing: border-box; | |
border-style: solid; | |
border-width: 0; | |
} |
This file contains hidden or 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
// Version 4.0 | |
// StackOverflow question that spawned pSBC | |
// ↳ https://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color-or-rgb-and-blend-colors | |
// Full writeup by author | |
// ↳ https://github.com/PimpTrizkit/PJs/wiki/12.-Shade,-Blend-and-Convert-a-Web-Color-(pSBC.js) | |
const pSBC=(p,c0,c1,l)=>{ | |
let r,g,b,P,f,t,h,i=parseInt,m=Math.round,a=typeof(c1)=="string"; | |
if(typeof(p)!="number"||p<-1||p>1||typeof(c0)!="string"||(c0[0]!='r'&&c0[0]!='#')||(c1&&!a))return null; | |
if(!this.pSBCr)this.pSBCr=(d)=>{ |
This file contains hidden or 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
* { | |
margin: 0; | |
padding: 0; | |
} | |
*, | |
*::after, | |
*::before { | |
box-sizing: inherit; | |
} |
This file contains hidden or 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
body { | |
font-family: -apple-system, /* (San Francisco) iOS Safari, macOS Safari, macOS Firefox. (San Francisco) iOS Safari, macOS Safari, macOS Firefox */ | |
BlinkMacSystemFont, /* (San Francisco) macOS Chrome */ | |
"Segoe UI", /* Windows */ | |
Roboto, /* Android, Chrome OS */ | |
Helvetica, /* Any */ | |
Arial, /* Any */ | |
sans-serif, /* Any */ | |
"Apple Color Emoji", /* Emojis */ | |
"Segoe UI Emoji", /* Emojis */ |
This file contains hidden or 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 rgb(r, g, b){ | |
return toHex(r) + toHex(g) + toHex(b); | |
} | |
function toHex(numb) { | |
if (numb <= 0) return '00'; | |
if (numb > 255) return 'FF'; | |
return numb.toString(16).toUpperCase(); | |
} |
This file contains hidden or 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
document.write(new Date().getFullYear()) |
This file contains hidden or 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 Tree(size, leaves) { | |
this.size = (typeof size === "undefined")? 10 : size; | |
const defaultLeaves = {spring: 'green', summer: 'green', fall: 'orange', winter: null}; | |
this.leaves = (typeof leaves === "undefined")? defaultLeaves : leaves; | |
this.leafColor; | |
} | |
Tree.prototype.changeSeason = function(season) { | |
this.leafColor = this.leaves[season]; | |
if (season === 'spring') { |
This file contains hidden or 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
// Helper function to convert NodeLists to Arrays | |
function slice(nodes) { | |
return Array.prototype.slice.call(nodes); | |
} | |
// Example usage | |
this.buttons = slice(this.el.querySelectorAll('.radio')); |
This file contains hidden or 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
// Shuffle function from http://stackoverflow.com/a/2450976 | |
function shuffle(array) { | |
var currentIndex = array.length, temporaryValue, randomIndex; | |
while (currentIndex !== 0) { | |
randomIndex = Math.floor(Math.random() * currentIndex); | |
currentIndex -= 1; | |
temporaryValue = array[currentIndex]; | |
array[currentIndex] = array[randomIndex]; | |
array[randomIndex] = temporaryValue; |