Skip to content

Instantly share code, notes, and snippets.

@PietroJomini
PietroJomini / BadCodeChallengePhoneNumberFormatter.c
Last active February 27, 2020 23:56
Bad Code Challenge - Phone Number Formatter
/*
https://www.reddit.com/r/badcode/comments/fa9hoa/bad_code_coding_challenge_31_phone_number/
On invalid input, return "😒"
I don't know what the hell I did,
and I won't even start listing the problems with this code.
Enjoy
*/
@PietroJomini
PietroJomini / oneliner.js
Created February 27, 2020 11:23
ah, yes, 𝚘𝚗𝚎𝚕𝚒𝚗𝚎𝚛
data = await page.evaluate(() => [...document.querySelector('div.content > table.rows > tbody').childNodes].slice(1).map(el => [...el.childNodes].slice(0, -1).map(el => el)).map((el, index) => { return { index, number: el[0].innerText, date: el[1].innerText, title: el[2].firstChild.innerText, classi: el[2].lastChild.innerText.split(' ').slice(1).map(el => el.replace(',', '').replace('ª', '')) }; }));