cleanup and update metadata
This commit is contained in:
parent
1d28bd144d
commit
b9c6360f78
1 changed files with 2 additions and 132 deletions
134
src/lib/index.ts
134
src/lib/index.ts
|
|
@ -1,127 +1,3 @@
|
|||
// export function blog(api: string, base?: string) {
|
||||
// return fetch(`${api}/api/collections/blogs/records?page=1&perPage=1&fields=collectionId,id,title,desc,created,thumbnail&sort=-created`)
|
||||
// .then(res => res.json())
|
||||
// .then((data: {
|
||||
// items: {
|
||||
// collectionId: string,
|
||||
// id: string,
|
||||
// title: string,
|
||||
// desc: string,
|
||||
// created: number,
|
||||
// thumbnail: string,
|
||||
// }[]
|
||||
// }) => {
|
||||
// const blog = data.items[0];
|
||||
|
||||
// return {
|
||||
// title: blog.title,
|
||||
// desc: blog.desc,
|
||||
// created: blog.created,
|
||||
// // thumbnail: `${api}/api/files/${blog.collectionId}/${blog.id}/${blog.thumbnail}?thumb=320x160`,
|
||||
// url: !base ? '' : `${base}/${blog.id}`,
|
||||
// };
|
||||
// });
|
||||
// }
|
||||
|
||||
// export function github(max: number, user: string) {
|
||||
// return fetch(`https://api.github.com/users/${user}/repos?per_page=${max}?type=owner&sort=created`)
|
||||
// .then(res => res.json())
|
||||
// .then((data:
|
||||
// {
|
||||
// fork: boolean,
|
||||
// name: string,
|
||||
// description: string,
|
||||
// html_url: string,
|
||||
// stargazers_count: number,
|
||||
// language: string,
|
||||
// }[]
|
||||
// ) => data.filter(repo => !repo.fork).slice(0, max).map(repo => ({
|
||||
// name: repo.name,
|
||||
// desc: repo.description,
|
||||
// url: repo.html_url,
|
||||
// stars: repo.stargazers_count,
|
||||
// lang: repo.language,
|
||||
// }))).catch((e) => [
|
||||
// { name: 'Error', desc: e.message, url: '', stars: 0, lang: '' },
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// export function discord(id: string) {
|
||||
// return fetch(`https://api.lanyard.rest/v1/users/${id}`)
|
||||
// .then(res => res.json())
|
||||
// .then(({data}: {
|
||||
// data: {
|
||||
// discord_user: {
|
||||
// id: string,
|
||||
// username: string,
|
||||
// avatar: string,
|
||||
// },
|
||||
// discord_status: string,
|
||||
// spotify: {
|
||||
// album_art_url: string,
|
||||
// track_id: string,
|
||||
// song: string,
|
||||
// artist: string,
|
||||
// },
|
||||
// activities: {
|
||||
// type: number,
|
||||
// name: string,
|
||||
// created_at: number,
|
||||
// state: string,
|
||||
// details: string,
|
||||
// assets: {
|
||||
// large_image: string,
|
||||
// small_image: string,
|
||||
// },
|
||||
// application_id: string,
|
||||
// }[],
|
||||
// }
|
||||
// success: boolean,
|
||||
// }) => ({
|
||||
// // avatar: `https://cdn.discordapp.com/avatars/${data.discord_user.id}/${data.discord_user.avatar}.png?size=128`,
|
||||
// username: data.discord_user.username,
|
||||
// status: data.discord_status,
|
||||
// spotify: {
|
||||
// art: data?.spotify?.album_art_url,
|
||||
// link: `https://open.spotify.com/intl-id/track/${data?.spotify?.track_id}`,
|
||||
// song: data?.spotify?.song,
|
||||
// artist: data?.spotify?.artist,
|
||||
// },
|
||||
// activity: data?.activities.filter((a: {type:number}) =>a.type===0).map((activity:
|
||||
// {name: string, created_at: number, state: string, details: string, assets: {large_image: string, small_image: string}, application_id: string}
|
||||
// ) => ({
|
||||
// name: activity.name,
|
||||
// started: activity.created_at,
|
||||
// state: activity.state,
|
||||
// details: activity.details,
|
||||
// images: {
|
||||
// large: !activity?.assets?.large_image ? '' : `https://cdn.discordapp.com/app-assets/${activity.application_id}/${activity?.assets?.large_image}.png?size=256`,
|
||||
// small: !activity?.assets?.small_image ? '' : `https://cdn.discordapp.com/app-assets/${activity.application_id}/${activity?.assets?.small_image}.png?size=256`,
|
||||
// },
|
||||
// })).sort((a: {started:number}, b: {started:number}) => b.started - a.started) || [],
|
||||
// })).catch(() => ({
|
||||
// username: 'Error',
|
||||
// status: 'Error',
|
||||
// spotify: {
|
||||
// art: '',
|
||||
// link: '',
|
||||
// song: '',
|
||||
// artist: '',
|
||||
// },
|
||||
// activity: [],
|
||||
// }));
|
||||
// }
|
||||
|
||||
export function daysUntilBirthday(date: number[]): number {
|
||||
const today = new Date();
|
||||
const birthday = new Date(today.getFullYear(), date[1] - 1, date[0]);
|
||||
if (today > birthday) {
|
||||
birthday.setFullYear(today.getFullYear() + 1);
|
||||
}
|
||||
// @ts-ignore
|
||||
return Math.ceil((birthday - today) / 86400000);
|
||||
}
|
||||
|
||||
export function getTimeIn(timezone: string): string {
|
||||
const options = { timeZone: timezone, hour12: true, hour: 'numeric', minute: 'numeric' };
|
||||
// @ts-ignore
|
||||
|
|
@ -168,19 +44,13 @@ export function randomStr(length: number): string {
|
|||
return result;
|
||||
}
|
||||
|
||||
export const textColors = [
|
||||
'text-ctp-red', 'text-ctp-peach', 'text-ctp-yellow', 'text-ctp-green',
|
||||
'text-ctp-teal', 'text-ctp-blue', 'text-ctp-mauve', 'text-ctp-pink',
|
||||
'text-ctp-lavender', 'text-ctp-sapphire', 'text-ctp-sky',
|
||||
];
|
||||
|
||||
export default {
|
||||
title: "satr14's site",
|
||||
quote: "sometimes you just gotta implement it yourself",
|
||||
name: "satr14",
|
||||
roles: ["Web Developer", "Sysadmin", "Hobbyist", "Student"],
|
||||
description: "I'm Satria, Im a self-taught hobbyist web developer and homelaber sysadmin from Indonesia. I've been programming since 2021 and I love spending my free time working on personal projects and experimenting with new technologies.",
|
||||
skills: ["HTML", "CSS", "JavaScript", "Tailwind", "Svelte", "SvelteKit", "TypeScript", "NodeJS", "Express", "PocketBase", "Python", "Linux", "Nginx", "Docker", "Git", "Bash", "Proxmox", "Nix"],
|
||||
description: "I'm Satria, Im a self-taught hobbyist web developer and homelaber sysadmin from Indonesia. I've been programming since 2021 and spend my free time working on personal projects and experimenting with new technologies.",
|
||||
skills: ["Tailwind", "SvelteKit", "TypeScript", "Bun", "Express", "PocketBase", "Linux", "Nginx", "Docker", "Git", "Bash", "Proxmox", "Nix"],
|
||||
timezone: "Asia/Jakarta",
|
||||
location: "Indonesia",
|
||||
links: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue