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
// youtube-iframe-faster.js v1 | |
function youtubeIframeFaster(youtubeID, userOptions = {}, callback) { | |
if (typeof youtubeID !== 'string'){ | |
return console.error('The youtubeID argument is required and must be of the type string.'); | |
}; | |
let element = document.querySelector(`#${youtubeID}`), | |
options = { // everyone is boolean | |
autoplay: false, | |
autoTitle: true, // iframe attribute title="${videoTitle}" | |
loop: false, |
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
// milA.js v1 | |
function milA(repeat = 1){ | |
let a = ''; | |
for(let i = 0; i < repeat; i++){ | |
a += 'a'; | |
}; | |
return a; | |
}; |
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
// cache-expires-after.js v1 | |
function cacheExpiresAfter(delay = 1, prefix = '', suffix = '') { // seconds | |
let now = new Date().getTime().toString(); | |
now = now.substring(now.length - 11, 10); // remove decades and milliseconds | |
now = parseInt(now / delay).toString(); | |
return prefix + now + suffix; | |
}; |
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
// log-css.js v2 | |
const log = console.log.bind() | |
const css = (text, options) => { | |
let cssOptions = '' | |
for (let prop in options) { | |
const value = options[prop] | |
prop = camelCaseToDashCase(prop) | |
cssOptions += `${prop}: ${value}; ` | |
} | |
return [`%c${text}`, cssOptions.trim()] |
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
/* dependencies: jquery: https://code.jquery.com/jquery-3.4.1.min.js | |
jquery-shadowRoot.js: https://gist.github.com/luislobo14rap/0eeb4ff1c67ada1805e80d3553c7a1a6 */ | |
$('extensions-manager').shadowRoot().find('#items-list').shadowRoot().find('.items-container').find('extensions-item').each(function(){ | |
console.log( $(this).attr('id') ); | |
}); |
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
// remove-of-array.js v1 | |
function removeOfArray(array_, item) { | |
while (array_.indexOf(item) > -1) { | |
let i = array_.indexOf(item); | |
if (i > -1) { | |
array_.splice(i, 1); | |
}; | |
}; | |
return array_; | |
}; |
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
<div *ngFor="let index of repeatFor(3)"> | |
{{index}} | |
</div> |
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
// reclame-aqui.js v2 | |
// https://www.reclameaqui.com.br | |
var s = ' '; | |
var $ = function(selector){ | |
return document.querySelector(selector); | |
}; | |
var $$ = function(selector){ | |
return document.querySelectorAll(selector); | |
}; | |
var url = window.location.href; |