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
/*! | |
* is.js 0.9.0 | |
* Author: Aras Atasaygin. Adapted by Luis Lobo | |
*/ | |
// define 'is' object and current version | |
let is = {}; | |
is.VERSION = '0.9.0'; | |
// store navigator properties to use later |
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
"Se A é o total, e tenho B, quantos correspondem a 50?" | |
"Se 'a' é um valor e 'b' é o total, qual a porcentagem que 'a' representa de 'b'?" | |
// CANSEI CONTINUAR DEPOIS | |
// math-utils.js v1 | |
Math.avg = (...numbers) => Math.sum(...numbers) / numbers.length | |
Math.distance = (a, b) => Math.abs(a - b) | |
Math.isApproximate = (a, b, tolerance = 0) => Math.abs(a - b) <= tolerance | |
Math.isBetween = (number, min, max) => number >= min && number <= max | |
Math.isEven = number => number % 2 === 0 |
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
// create-style.js v1 | |
function createStyle(cssString) { | |
const head = document.querySelector("head"), | |
style = document.createElement("style") | |
style.setAttribute("type", "text/css") | |
style.append(document.createTextNode(cssString)) | |
head.append(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
<!doctype html> | |
<html lang="pt-br"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes, shrink-to-fit=no" /> | |
<title></title> | |
<!-- LIBS --> |
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
// odd-or-even.js v1 | |
function oddOrEven(number_){ // 0 = even, 1 = odd | |
return number_ % 2 === 0 ? 0 : 1; | |
}; | |
// is-odd.js v1 | |
function isOdd(number_){ | |
return number_ % 2 !== 0; | |
}; | |
// is-even.js v1 | |
function isEven(number_){ |
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
// plyr-in-chrome.js v1.4 | |
if(isLocalFile() | isLocalIp()){ | |
const $ = (selector, scope = document) => { | |
return scope.querySelector(selector); | |
}; | |
const createElement = (element) => { | |
return document.createElement(element); | |
}; |
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
// random-between.js v1.1 | |
function randomBetween(min, max) { | |
const range = max + 1 - min | |
return min + Math.floor(Math.random() * range) | |
} | |
// random-between.js v2 | |
function randomBetween(min, max) { | |
const range = max + 1 - min, | |
randomValue = (window.crypto || window.msCrypto).getRandomValues(new Uint32Array(1))[0] |
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
// change-url-without-reload.js v1 | |
function changeURLWithoutReload(newUrl){ | |
let url = getURL(); | |
return window.history.pushState(undefined, undefined, url + '/' + newUrl.replace(/^\//, '')); | |
}; | |
// getURL.js v1 | |
function getURL(url = window.location.href){ | |
return url.split(/[?#&]/)[0].replace(/\/+$/, ''); | |
}; |
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
// setTimesout.js v2 | |
function setTimesout(function_ = (time, index) => {}, repeats = [0]) { | |
repeats = repeats.sort((a, b) => { | |
return a - b | |
}) | |
for (let i = 0; i < repeats.length; i++) { | |
setTimeout(() => { | |
function_(time = repeats[i], index = i) | |
}, repeats[i]) | |
} |
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
/* flex-center.css v1 */ | |
.flex-center { | |
align-items: center; | |
display: flex; | |
justify-content: center; | |
} |
NewerOlder