• Nov 19, 2022 •CodeCatch
0 likes • 1 view
// `date` is a `Date` object const formatYmd = date => date.toISOString().slice(0, 10); // Example formatYmd(new Date()); // 2020-05-06
• Jan 25, 2023 •C S
0 likes • 9 views
// Vanilla JS Solution: var app = document.getElementById('app'); var typewriter = new Typewriter(app, { loop: true }); typewriter .typeString("I'm John and I'm a super cool web developer") .pauseFor(3000) .deleteChars(13) // "web developer" = 13 characters .typeString("person to talk with!") // Will display "I'm John and I'm a super cool person to talk with!" .start(); // React Solution: import Typewriter from 'typewriter-effect'; <Typewriter options={{ loop: true }} onInit={typewriter => { typewriter .typeString("I'm John and I'm a super cool web developer") .pauseFor(3000) .deleteChars(13) // "web developer" = 13 characters .typeString("person to talk with!") // Will display "I'm John and I'm a super cool person to talk with!" .start(); }} />
• Mar 11, 2021 •C S
0 likes • 2 views
import { configureStore } from "@reduxjs/toolkit"; import { combineReducers } from "redux"; import profile from "./profile"; import auth from "./auth"; import alert from "./alert"; const reducer = combineReducers({ profile, auth, alert, }); const store = configureStore({ reducer }); export default store;
• Mar 10, 2022 •LeifMessinger
//Use at https://mee6.xyz/leaderboard/732262089447702588 //Higher the spammy stat, the more spammy that person is. //This is because mee doesn't give experience to people who post more comments in a minute. function statBlock(title, value){ let elm = document.createElement("div"); elm.className = "leaderboardPlayerStatBlock"; let titleElm = document.createElement("div"); titleElm.className = "leaderboardPlayerStatName"; titleElm.textContent = title; let valueElm = document.createElement("div"); valueElm.className = "leaderboardPlayerStatValue"; valueElm.textContent = value; elm.appendChild(titleElm); elm.appendChild(valueElm); elm.remove = function(){ this.parentElement.removeChild(this); } return elm; } for(let player of Array.from(document.getElementsByClassName("leaderboardPlayer"))){ if(player.spamminess) player.spamminess.remove(); let messages = null; let experience = null; const statBlockArray = Array.from(player.querySelectorAll(".leaderboardPlayerStatBlock")); for(let statBlock of statBlockArray){ const statName = statBlock.querySelector(".leaderboardPlayerStatName").textContent; const text = statBlock.querySelector(".leaderboardPlayerStatValue").textContent; const number = ((text.includes("k"))? (text.replace("k","") * 1000.0) : +(text)); if(statName.includes("MESSAGES")){ messages = number; }else if(statName.includes("EXPERIENCE")){ experience = number; } } const stats = player.querySelector(".leaderboardPlayerStats"); const messagesElement = stats.firstChild; const spamminess = ((messages/experience)*2000.0).toFixed(2); player.spamminess = stats.insertBefore(statBlock("SPAMMINESS", spamminess), messagesElement); }
const powerset = arr => arr.reduce((a, v) => a.concat(a.map(r => r.concat(v))), [[]]); powerset([1, 2]); // [[], [1], [2], [1, 2]]
0 likes • 0 views
const getTimezone = () => Intl.DateTimeFormat().resolvedOptions().timeZone; // Example getTimezone();