Skip to content

Instantly share code, notes, and snippets.

View joeelmahallawy's full-sized avatar
😉
Cooking up the next blue chip

Youssef El Mahallawy joeelmahallawy

😉
Cooking up the next blue chip
View GitHub Profile

Keybase proof

I hereby claim:

  • I am joeelmahallawy on github.
  • I am joeel (https://keybase.io/joeel) on keybase.
  • I have a public key ASAxTHmnaXMfSCbtucZRw2GSEcJ67VtBXn2WJNn8xi2oFwo

To claim this, I am signing this object:

import { Box, Button, Center, Input, Title } from "@mantine/core";
import React, { useState } from "react";
const IndexPage = () => {
const [newTodo, setNewTodo] = useState("");
const [todos, setTodos] = useState<string[]>([]);
return (
<Center style={{ flexDirection: "column", padding: 10 }}>
<Title>Next.js + Serve todo app</Title>
import { NextApiRequest, NextApiResponse } from "next";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
switch (req.method) {
case "GET":
const getTodos = await fetch(
"https://api.withserve.com/v1/workflows/7cb831a8-2507-4e46-84d1-5bbc25419fb5?apiKey=9c2fb0d1-bbaf-4d78-a58d-2b590622cc6c",
{ method: req.method }
);
import { Box, Button, Center, Input, Title } from "@mantine/core";
import React, { useEffect, useState } from "react";
const IndexPage = () => {
const [newTodo, setNewTodo] = useState("");
const [todos, setTodos] = useState<{ id: string; task: string }[]>([]);
useEffect(() => {
(async () => {
const getTodos = await fetch(`/api/todos`, { method: "GET" });
import {
Box,
Button,
Center,
createStyles,
Input,
Text,
Title,
} from "@mantine/core";
import React, { useEffect, useState } from "react";
import { NextApiRequest, NextApiResponse } from "next";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
// we'll check the request method so we can choose what we want to do
switch (req.method) {
case "GET":
// url for executing: SELECT * FROM todo
const getTodos = await fetch(
"https://api.withserve.com/v1/workflows/7cb831a8-2507-4e46-84d1-5bbc25419fb5?apiKey=9c2fb0d1-bbaf-4d78-a58d-2b590622cc6c",
import { NextApiRequest, NextApiResponse } from "next";
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
try {
// we'll check the request method so we can choose what we want to do
switch (req.method) {
case "GET":
// url for executing: SELECT * FROM todo
const getTodos = await fetch(
"https://api.withserve.com/v1/workflows/7cb831a8-2507-4e46-84d1-5bbc25419fb5?apiKey=9c2fb0d1-bbaf-4d78-a58d-2b590622cc6c",
@joeelmahallawy
joeelmahallawy / content.tsx
Created January 7, 2023 01:04
Mantine + Plasmo page
import createCache from "@emotion/cache"
import { Button, Image, MantineProvider, Popover, Text } from "@mantine/core"
import { NotificationsProvider, showNotification } from "@mantine/notifications"
import type { PlasmoContentScript, PlasmoGetInlineAnchor } from "plasmo"
import type { PlasmoGetStyle } from "plasmo"
import React, { useEffect, useRef, useState } from "react"
import Fade from "react-reveal/Fade"
import AppModal from "~components/appModal"
import type { EmotionCache } from "@emotion/react";
import { MantineProvider } from "@mantine/core";
import createCache from "@emotion/cache";
const dynamicStyleTagsIDs = [];
const usedStyleTagIDs = {};
// to render this element in every instance of: <div role="textbox">...</div>
export const getInlineAnchorList: PlasmoGetInlineAnchorList = async () =>
document.querySelectorAll(`div[role="textbox"]`);
export const UserContext = React.createContext(null);
const IndexPage = () => {
const [session, setSession] = useState(null);
useEffect(() => {
(async () => {
const getUser = await fetch(`/api/session`, {
headers: { Authorization: `Bearer ${getCookie("jwt")}` },