Mira – Telegram
Mira
748 subscribers
818 photos
25 videos
20 files
267 links
sporadic attempts at life.
personal channel

files: @mira_files
playlist: @the_coding_playlist
Download Telegram
it's so off displaying your framework's generic 500 pages. in svelte, i do something like


// src/lib/server/utils/safe-page-load.ts
import type { ServerLoadEvent } from '@sveltejs/kit';

export function safePageLoad<T>(
loadFn: (event: ServerLoadEvent) => Promise<T>
) {
return async (event: ServerLoadEvent) => {
try {
const result = await loadFn(event);
return { ...result, error: null };
} catch (err) {
console.error('safePageLoad error:', err);
return {
error: {
message: 'Something went wrong. Please try again later.', // this is probably a connectivity issue. so you can display something like "Check your internet connection"
details: process.env.NODE_ENV === 'development' ? String(err) : undefined
}
} as T & { error: { message: string; details?: string } };
}
};
}


then your +page.server.ts will be


import { eq } from 'drizzle-orm';
import { safePageLoad } from '$lib/server/utils/safe-page-load';
import { db } from '$lib/server/db';

export const load = safePageLoad(async ({ locals }) => {
const { user } = locals;
const myQueryResults = await db.query.something.findMany({
where: eq(something.id, user.id)
});
return { myQueryResults };
});


if you protect your routes in root +layout.server.ts, auth errors will never bubble up that far, so the error is only user's connectivity issue. then data.error will be set a value, and you can show a nice UI instead of the generic 500 page


<noscript lang="ts">
let { data } = $props()
</noscript>

{#if data.error}
<ErrorComponent />
{:else}
<div class="grid gap-4">
{#each myQueryResults as result}
{ result }
{/each}
</div>
{/if}
pov: you just found out billie jean ain't your lover
😭10
thanks to yohannes i am now in the queue waiting for fetira 😭
Please open Telegram to view this post
VIEW IN TELEGRAM
😁11
this is how you cook your opps
52🔥1
you can't be hot and cool at the same time. sweetheart, that's just how thermodynamics works.
(pure cope)
😁19😭6🤣31
>omg who's that monkey
>look inside
>me 4 years ago
😁16😭6🔥1
bro made it to my codebase 🙂
Please open Telegram to view this post
VIEW IN TELEGRAM
😁15
only slept for like 3 hours in the past 44 hours. i look like i have been high for the straight two days. welp, let's sleep now. see y'all at night with some spam energy 🥺
Please open Telegram to view this post
VIEW IN TELEGRAM
15😁3
beautiful you are, like a storm i don’t run from. you’ll wreck the place, smile about it, and somehow i’ll thank you for it. i tell myself i’m fine, that i’m choosing this, but really i just like watching the fire and pretending it’s warmth. you tear things apart just to see what’s inside, i stand there calling it beauty and stay close enough to get burned. it’s easier to stay in the wreckage than face the quiet after. because the silence asks questions i can’t answer. maybe there is no meaning, maybe it’s just the comfort of knowing pain won’t lie to me. and i guess this is all it is, to circle the same ache and calling it purpose, because it’s the only thing that still feels real.
#inkwave
4🥰2👍1😁1
ladies and gents, it's the weekend
4
i be seeing these kids and lowkey miss highschool drama. not like i used to enjoy going to classes. legit my english teacher be like "i haven't seen you the entire week". wym nigga i ain't showing up till you give quizzes.
😁11
nonsense, but wild.
if i were on my 30s and married someone on her 20s, she's just 10y/o now 🥺
Please open Telegram to view this post
VIEW IN TELEGRAM
😭161
google got this extension in editors. just like cline but with more features. pros: 240 requests per day and 180k code completions per month. it's available in most IDEs. it kinda looks nice, do check it out

https://open-vsx.org/extension/Google/geminicodeassist

they also got gemini CLI companion extension so that you can connect gemini CLI with your preferred editor and see the diff inside the editor. use the /ide command in the CLI to connect it with your editor

https://open-vsx.org/extension/Google/gemini-cli-vscode-ide-companion
👍31
so this was astu 12 years ago? 🙂 adama peeps were something else tho. i liked them
Please open Telegram to view this post
VIEW IN TELEGRAM
>mentions myself
🤣17🥰41
just now 🙂
#shot
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥16❤‍🔥1
chopped?
😭72❤‍🔥1
to carry another’s chaos in your pockets as if it were treasure, to lose your balance and call it grace. it hurts just enough to feel alive.
3💯2