ibrahimyaacob
ibrahimyaacob
Explore posts from servers
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 7/13/2024 in #questions
How do you achieve this with T3 stack SEO
No description
3 replies
PD🧩 Plasmo Developers
Created by ibrahimyaacob on 5/28/2024 in #🔰newbie
I want to modify the DOM, which api should i use ?
I basically want to take a name of a text and bold it. example original: <p>Hello World</p> modified: <p>Hello <b>World</b></p>
11 replies
RRailway
Created by ibrahimyaacob on 3/17/2024 in #✋|help
Error deploying Turborepo project with a fastify workspace
No description
23 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 12/25/2023 in #questions
I need to validate the uploaded file on clientside before perform upload
I encounter this error on the onBeforeUploadBegin callback function. any other suggestion on how can i achieve the objective ?
2 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 11/2/2023 in #questions
How did Vercel Implement this ??
No description
12 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 11/2/2023 in #questions
How to simulate Open AI's word by word stream works in the backend?
I have a completed string and i want to deliver it word by word instead of dumping the whole string. Apparently the example from chatgpt doesnt works
import { type NextApiRequest, type NextApiResponse } from "next";
import stream from "stream";

export default function Handler(req: NextApiRequest, res: NextApiResponse) {
// Set the response headers to indicate it's a text stream
res.setHeader("Content-Type", "text/event-stream");

// Create a readable stream from your string
const wordsToStream =
"This is the string you want to s as daslfalfj kldfklsad nhkgl skgskdg njkhdgnkjdnj njknjksjgnsjd gsdng ds sndgk dskl stream\n";

const words = wordsToStream.split(" ");
let currentIndex = 0;

const readableStream = new stream.Readable({
read(size) {
if (currentIndex < words.length) {
this.push(words[currentIndex] + " "); // Push a word with a space
currentIndex++;
setTimeout(() => {
this._read();
}, 1000); // Delay for 500 milliseconds
} else {
this.push(null); // Signal the end of the stream
}
},
});

// Pipe the readable stream to the response
readableStream.pipe(res);
}
import { type NextApiRequest, type NextApiResponse } from "next";
import stream from "stream";

export default function Handler(req: NextApiRequest, res: NextApiResponse) {
// Set the response headers to indicate it's a text stream
res.setHeader("Content-Type", "text/event-stream");

// Create a readable stream from your string
const wordsToStream =
"This is the string you want to s as daslfalfj kldfklsad nhkgl skgskdg njkhdgnkjdnj njknjksjgnsjd gsdng ds sndgk dskl stream\n";

const words = wordsToStream.split(" ");
let currentIndex = 0;

const readableStream = new stream.Readable({
read(size) {
if (currentIndex < words.length) {
this.push(words[currentIndex] + " "); // Push a word with a space
currentIndex++;
setTimeout(() => {
this._read();
}, 1000); // Delay for 500 milliseconds
} else {
this.push(null); // Signal the end of the stream
}
},
});

// Pipe the readable stream to the response
readableStream.pipe(res);
}
2 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 10/19/2023 in #questions
with trpc, how to invalidate query only when there's the query cached exist?
it seems like utils.myRouter.myQuery.invalidate(), triggers the query, even though api.myRouter.myQuery.useQuery() is not called from the page. how do i prevent this
3 replies
TtRPC
Created by ibrahimyaacob on 10/19/2023 in #❓-help
does api.myQuery.invalidate() works if the query is not made at the first place?
from testing, the invalidate runs the query, but it shouldn't because there is no cache? how do i invalidate ONLY when the cache exist ?
3 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 10/16/2023 in #questions
npx create/npm create just freeze forever
No description
2 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 9/8/2023 in #questions
vercel webhook for hobby plan
Is there such thing ? I cannot find it in the menu? what i'm trying to do is to perform request upon successful deployment production branch
2 replies
PD🧩 Plasmo Developers
Created by ibrahimyaacob on 4/30/2023 in #🔰newbie
I want to fill in a form in page from a popup input & button
Can anyone help give me an outline of how to perform this action ?
1 replies
TtRPC
Created by ibrahimyaacob on 4/30/2023 in #❓-help
returning undefined from server gets stripped on the client
8 replies
TTCTheo's Typesafe Cult
Created by ibrahimyaacob on 4/13/2023 in #questions
clerk typesafe metadata
Just how exactly do I do it ?
2 replies