Skip to content

Instantly share code, notes, and snippets.

View iamhectorsosa's full-sized avatar

Hector Sosa iamhectorsosa

View GitHub Profile
@iamhectorsosa
iamhectorsosa / Layout.astro
Last active February 18, 2024 14:28
Adding Scripts Affects TypeScript Intellisense on .astro file
---
import "@/styles/global.css";
interface Props {
title: string;
}
const { title } = Astro.props;
---
<script is:inline>
@iamhectorsosa
iamhectorsosa / index.html
Last active January 29, 2024 08:46
Set Figures
<div class="flex min-h-screen items-center justify-center bg-slate-100">
<div class="grid w-full grid-cols-3 gap-[2%] p-[10%]">
<div class="card">
<div class="oval green empty pattern"></div>
<div class="oval green empty pattern"></div>
</div>
<div class="card">
<div class="oval pink empty pattern"></div>
<div class="oval pink empty pattern"></div>
</div>
@iamhectorsosa
iamhectorsosa / migration.sql
Created December 18, 2023 13:06
Profile Module Migration
-- Create `public.profiles` table
CREATE TABLE public.profiles (
user_id UUID PRIMARY KEY REFERENCES auth.users (id) ON DELETE CASCADE NOT NULL,
email VARCHAR(255) UNIQUE,
username VARCHAR(128) UNIQUE,
avatar TEXT,
preferred_name TEXT,
first_name TEXT,
last_name TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
import * as React from 'react';
import { usePagination } from '@shared';
import { useQueryParams } from '../../../utilities/useQueryParams';
import { PagingInput } from '../../../graphql';
interface UseQueryParamsPagination
extends Pick<
ReturnType<typeof usePagination>,
'start' | 'end' | 'setPageToFirst'
> {
import { Homepage } from "@components/preview/Homepage";
import { type FileType, getPaths, getPreviewProps } from "@utils/preview";
export default function Page({
fileTree,
selectedPath,
isFolder,
html,
sourceCode,
}: {
@iamhectorsosa
iamhectorsosa / rehypeShiki.ts
Created June 22, 2023 13:40
Shiki as a Rehype Plugin
import unifiedTypes, { unified } from "unified";
import { modifyChildren as unistUtilModifyChildren } from "unist-util-modify-children";
import { toText as hastUtilToText } from "hast-util-to-text";
import { getHighlighter } from "shiki";
import rehypeParse from "rehype-parse";
import { render, type Options } from "@lib/shiki";
export const rehypeShiki: unifiedTypes.Plugin<[options: Options]> =
(options) => async (tree) => {
const highlighter = await getHighlighter({
@iamhectorsosa
iamhectorsosa / index.html
Last active April 23, 2023 10:30
Boilerplate for Dark mode support
<mjml>
<mj-head>
<mj-font
name="Roboto"
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap"
></mj-font>
<mj-raw>
<meta name="color-scheme" content="light dark" />
<meta name="supported-color-schemes" content="light dark" />
</mj-raw>
.bg-slate > div {
background-color: #64748b !important;
}
.text-slate > div {
color: #64748b !important;
}
.bg-gray > div {
background-color: #6b7280 !important;
}
@iamhectorsosa
iamhectorsosa / index.html
Created March 28, 2023 08:44
Shiki Syntax Highlighter
<div id="output"></div>
@iamhectorsosa
iamhectorsosa / Tabs.tsx
Created February 19, 2023 17:42
Testing out Tab Component
import {
createContext,
forwardRef,
PropsWithChildren,
useContext,
useState,
} from "react";
import { SiReact, SiJavascript, SiTypescript, SiJson } from "react-icons/si";
type TabsContextProps = {