Back
Learning to code
#code make a script that will collect emails from fastmail and scroll down automatically:
const emailData = [];
(async () => {
const scrollContainer = document.querySelector('ul.u-list-body.v-Mailbox');
if (!scrollContainer) {
console.error('Unable to find the scroll container.');
return;
}
const processedItems = new Set();
let previousItemCount = 0;
// Utility function to delay execution
function wait(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
while (true) {
let liElements = document.querySelectorAll('li.v-MailboxItem');
// Process any new li elements
for (const li of liElements) {
// Use a unique key. If 'id' is stable and unique, keep it.
// Otherwise, consider using something like li.querySelector('.v-MailboxItem-link').href or subject text.
const uniqueKey = li.id || li.querySelector('a.v-MailboxItem-link')?.href;
if (!uniqueKey) continue; // If we can't find a stable key, skip.
if (!processedItems.has(uniqueKey)) {
processedItems.add(uniqueKey);
// Simulate the action of viewing the email to get the "v-Message-toName"
li.click();
await wait(1000); // Wait longer to ensure the email content is loaded
const span = document.querySelector('span.v-Message-toName');
if (span) {
emailData.push(span.textContent.trim());
} else {
console.warn(`No "v-Message-toName" found for item with unique key: ${uniqueKey}`);
}
// (Optional) Close the opened message or go back if needed.
// document.querySelector('button.back-button')?.click();
// await wait(500);
}
}
// Check if we got more items after processing
liElements = document.querySelectorAll('li.v-MailboxItem');
const currentItemCount = liElements.length;
// If no new items have appeared after processing the currently visible ones, we try scrolling
if (currentItemCount > previousItemCount) {
previousItemCount = currentItemCount;
} else {
// Try to scroll further to load more items
// Scroll to the bottom of the container
scrollContainer.scrollTop = scrollContainer.scrollHeight;
await wait(2000);
// Check again if new items appeared
liElements = document.querySelectorAll('li.v-MailboxItem');
if (liElements.length <= previousItemCount) {
// No new items after scrolling
break;
} else {
previousItemCount = liElements.length;
}
}
}
console.log('Collected Emails:', emailData);
})();
#code crash chat gpt on macOS. it doesn’t open anymore. F
#code try ChatGPT macOS with VSCode and Terminal
Switched from Postmark to Mailtrap.io to sending ~1M emails per month, cuz cheaper and better stats design + the team helped to improve open / bounce rates #code
#code discover that mcdonalds has cool animation on buttons hover (different every time)
#code create a pull request to openai ruby gem about how to use transcribe method with ruby on rails and active storage, cuz I spent an hour trying to figure it out, until @marc told me how to do it github.com/alexrudall/ruby-op…
open source my own twitter method to post tweets via code, cuz all existing gems are too complex github.com/AndreyAzimov/twitt… #code
learn how to run 2 rails apps on local host on different ports PORT=4000 rails s #code
#code make first Ruby mini open source project github.com/AndreyAzimov/ruby-…
#code become ruby pro and write something like @marckohlbrugge would wrote
#code get codepilot invite
create my own rails #code snippets in sublime like I had in php
Become Ruby on Rails contributor by adding Bootstrap to it twitter.com/dhh/status/143626… #code
add all terminal aliases so I don’t need to type it over and over again #code
#code install elixir and phoenix
#code create basic ruby on rails crud app using scaffolding, bootstrap and faker
#code complete just JustJavascript.com course by @dan_abramov
#code install react with next.js and make it run with a blog template on mdx vercel.com/new/clone?demo-des…