• Daily Sandbox
  • Posts
  • 🧨 Daily Digest: AI-Assisted Development and Mastering AWS S3 Image Uploads in Next.js

🧨 Daily Digest: AI-Assisted Development and Mastering AWS S3 Image Uploads in Next.js

PLUS: Streamline Postgres Operations, Webhooks, and Explore Open-Source Tools in Today’s Coding Toolbox

Daily Issue #40

🎆 NEWS, INNOVATIONS, TRENDS, TUTORIALS

const fileUploadParams = {
          Bucket: bucket,
          Key: key,
          Body: buffer,
          ContentType: file.type,
        };

        const imageParam = new PutObjectCommand(fileUploadParams);
        await s3.send(imageParam);

🧰 CODING TOOLBOX

  • chatwoot - Open-source live-chat, email support, omni-channel desk. An alternative to Intercom, Zendesk, Salesforce Service Cloud etc

  • immich - High performance self-hosted photo and video management solution.

  • text - Collaborative document editing using Markdown

  • CrossUI - a free Cross-Browser Javascript framework with cutting-edge functionality for rich web application

  • zulip - server and web application. Open-source team chat that helps teams stay productive and focused

#️⃣ DO YOU AI PROMPT?

Startup Tech Lawyer

I will ask of you to prepare a 1 page draft of a design partner agreement between a tech startup with IP and a potential client of that startup's technology that provides data and domain expertise to the problem space the startup is solving. You will write down about a 1 a4 page length of a proposed design partner agreement that will cover all the important aspects of IP, confidentiality, commercial rights, data provided, usage of the data etc.

💻 CODE SNIPPET OF THE DAY

Clearing Cookies and Cache in JavaScript

Problem: I needed to programmatically clear all cookies and cache (localStorage, sessionStorage) for a project. This can be useful for debugging, resetting the environment, or logging out users completely.

Solution: Implemented two functions—one for clearing cookies and another for clearing all local storage, session storage, and cookies.

/**
 * Clear all cookies
 */
function clearCookie() {
  const keyList = document.cookie.match(/[^ =;]+(?=\=)/g);
  keyList &&
    keyList.forEach(
      (key) =>
        (document.cookie = `${key}=0;path=/;expires=${new Date(
          0
        ).toUTCString()}`)
    );
}

/**
 * Clear all project cache
 */
function clearCache() {
  window.localStorage.clear();
  window.sessionStorage.clear();
  const keyList = document.cookie.match(/[^ =;]+(?=\=)/g);
  keyList &&
    keyList.forEach(
      (key) =>
        (document.cookie = `${key}=0;path=/;expires=${new Date(
          0
        ).toUTCString()}`)
    );
}

Keywords: JavaScript clear cookies, clear localStorage, clear sessionStorage, clear browser cache, clear project data, reset browser storage, cookie management in JavaScript.

🛠️ SUGGEST A TOOL

If you have built anything that you’d like to share with the community, get with me on X @dailysandbox_ 😀 

Reply

or to participate.