Skip to content

Instantly share code, notes, and snippets.

View Sama-004's full-sized avatar

samanyu Sama-004

View GitHub Profile
const messageParts = [
`From: ${emailProvider.email}`,
`To: ${Array.isArray(data.to) ? data.to.join(', ') : data.to}`,
`Subject: ${encodeHeader(data.subject || '')}`,
`Date: ${date}`,
`Message-ID: ${data.messageId}`,
//this is what is causing the error
data.references?.length
? `References: ${data.references.join(' ')}`
: null,
@Sama-004
Sama-004 / store-draft.ts
Created February 26, 2025 17:13
earlier when we were storing draft without any reference, it was working fine
'From: ' + this.emailProvider.email,
'To: ' + data.to,
'Subject: ' + data.subject,
'Date: ' + date,
'Content-Type: multipart/alternative; boundary="boundary"',
'MIME-Version: 1.0',
'',
'--boundary',
'Content-Type: text/plain; charset=utf-8',
'Content-Transfer-Encoding: 7bit',
export async function loader({ params }: LoaderFunctionArgs) {
//find messages from db
return {
chatMessages,
};
}
// this is for new messages
export async function action({ request, params }: ActionFunctionArgs) {
const formData = await request.formData();
export async function action({ request, params }: ActionFunctionArgs) {
const formData = await request.formData();
const message = formData.get("message");
const userId = params.id;
const newChat = await db
.insert(chats)
.values({
userId: userId as string,
title: `New Chat ${Date.now().toString()}`,
export async function loader({ request }: LoaderFunctionArgs) {
const emails = db query 1 (without await)
const folders = db query 2 (without await)
return defer({
emails,
folders,
});
}
let cache = {
services:
web:
restart: always
build: .
ports:
- '3000:3000'
environment:
- NODE_ENV=production
- NEXT_PUBLIC_ADMIN_EMAIL=${NEXT_PUBLIC_ADMIN_EMAIL}
- NEXT_PUBLIC_ADMIN_PASSWORD=${NEXT_PUBLIC_ADMIN_PASSWORD}
FROM oven/bun:alpine AS base
# Stage 1: Install dependencies
FROM base AS deps
WORKDIR /app
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile
# Stage 2: Build the application
FROM base AS builder
set -g default-terminal "screen-256color"
set -ga terminal-overrides ',*256color*:smcup@:rmcup@'
set -g mouse on
set-option -ga terminal-overrides "xterm-256color:Tc"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
[greenclip]
history_file = "/home/sama/.cache/greenclip.history"
max_history_length = 50
max_selection_size_bytes = 0
trim_space_from_selection = true
use_primary_selection_as_input = false
blacklisted_applications = []
enable_image_support = true
image_cache_directory = "/tmp/greenclip"
static_history = [
-- inserts a row into public.user_profiles with only id and user_id
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer set search_path = ''
as $$
begin
insert into public.user_profiles (id, user_id, username)
VALUES (new.id, new.id, (new.raw_user_meta_data->>'username'));
return new;