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 uniqueByCode = (arr) => { | |
const seenCodes = new Set(); | |
return arr.filter(item => { | |
if (seenCodes.has(item.code)) { | |
return false; | |
} else { | |
seenCodes.add(item.code); | |
return true; | |
} | |
}); |
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
document.querySelector('body > tp-yt-iron-overlay-backdrop').remove(); | |
document.querySelector('body > ytd-app > ytd-popup-container').remove(); |
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 replaceSlashesWithDashes(path) { | |
// Remove the leading and trailing slashes if they exist | |
const trimmedPath = path.replace(/^\/|\/$/g, ''); | |
// Replace all remaining slashes with dashes | |
return trimmedPath.replace(/\//g, '-'); | |
} |
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
import\s+(\w+)\s+from\s+'kepler\/lib\/components\/(?!\\1';)$ |
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 sortTableByColumn(tableId, columnIdx) { | |
const table = document.getElementById(tableId); | |
const tbody = table.querySelector('tbody'); | |
const rows = Array.from(tbody.getElementsByTagName('tr')); | |
rows.sort((rowA, rowB) => { | |
const cellA = rowA.getElementsByTagName('td')[columnIdx]; | |
const cellB = rowB.getElementsByTagName('td')[columnIdx]; | |
// Handle empty cells |
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
#!/bin/bash | |
# Function to count lines of code in a file | |
count_lines_of_code() { | |
local file=$1 | |
local lines=$(wc -l < "$file") | |
echo "$lines" | |
} | |
# Function to sort files based on lines of code |
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
/* Map function to iterate over questions and add the `asertion` any */ | |
function mapAgeGenderQuestionsAddAny(question) { | |
question.assertion = "any"; | |
return question; | |
} | |
/* Reducer function to alter the props of the age_and_gender{_2} pages */ | |
function reducerAgeAndGenderQuestion(questionProps) { | |
var tooltipValue = "You’ll miss out on certain plan types if you don’t submit your birth date and gender! If you only want to see Medicare Advantage, you can hit “Continue” to skip this question."; | |
var questions = questionProps.questions.map(mapAgeGenderQuestionsAddAny); | |
questionProps.tooltipHeadline = tooltipValue; |
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 startTimer(duration) { | |
var timer = duration, minutes, seconds; | |
var intervalId = setInterval(function () { | |
minutes = parseInt(timer / 60, 10); | |
seconds = parseInt(timer % 60, 10); | |
minutes = minutes < 10 ? "0" + minutes : minutes; | |
seconds = seconds < 10 ? "0" + seconds : seconds; | |
console.log(minutes + ":" + seconds); |
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
var init = {a: 123, b: 456, c: { d: false}}; | |
var output = {}; | |
for([key, output[key]] of Object.entries(init)); | |
console.log(output); |
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
/** | |
* A scrollto function enhanced | |
* @param {string} element The query selector of the destiny element | |
* @param {number} space Space between top and element on scroll (optional) | |
* @param {bool} notSmooth Define if the scroll speed must be smooth or auto (Default: Smooth) | |
*/ | |
function scrollToNative(element, space = 0, behaviorScroll = 'smooth') { | |
const tabsCta = document.querySelector(element).offsetTop | |
const top = tabsCta + space | |
const behavior = ['auto', 'smooth'].includes(behaviorScroll) |
NewerOlder