Skip to content

Instantly share code, notes, and snippets.

View MohammedALREAI's full-sized avatar
😉
I may be slow to respond.

Mohammed Al-Reai MohammedALREAI

😉
I may be slow to respond.
View GitHub Profile
import { NextApiRequest, NextApiResponse } from 'next';
import NextAuth, { InitOptions } from 'next-auth';
import Providers from 'next-auth/providers';
import { SessionUser } from 'lib/data-types';
import { getUserFromId, updateUser } from 'db/user-dao';
const options: InitOptions = {
providers: [
Providers.GitHub({
clientId: process.env.GITHUB_ID || '',
import React from "react";
import { Helmet } from "react-helmet-async";
import { useForm } from "react-hook-form";
import { Link } from "react-router-dom";
import { authTokenVar, isLoginVar } from "../Hocks/useApollo";
import { Button } from "../components/button";
import {MessageError}from'../components/Form/errorrMessage'
import { Input } from "../components/Form/input";
import { LOCALSTORAGE_TOKEN } from "../cosntatns";
import { useLoginMutationMutation as useLoginMutation } from "../generated/graphql";
import React, { useState } from 'react';
import Link from 'next/link';
import { Divider } from './devider';
import { AllArticles } from './Articales';
import { AllProject } from './AllProject';
import { Projects } from './syg';
interface Props {
color: string;
}
{
"compilerOptions": {
"outDir": "./lib",
"target": "es5",
"module": "esnext",
"baseUrl": ".",
"paths": {
"*": ["src/*"],
"@layout":["src/layout/*"],
@MohammedALREAI
MohammedALREAI / schema.prisma
Created September 6, 2021 23:20
this is scehma for project work in it.
generator client {
provider = "prisma-client-js"
previewFeatures = ["orderByRelation", "referentialActions", "nApi"]
}
datasource postgresql {
provider = "postgresql"
url = env("PG_CONNECTIONSTRING")
}
@MohammedALREAI
MohammedALREAI / schema.prisma
Created September 6, 2021 23:38
house prisma
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "postgresql"
url = env("PG_CONNECTIONSTRING")
}
@MohammedALREAI
MohammedALREAI / Redis.ts
Created September 6, 2021 23:53
Redis simple used
const RedisStore = connectRedis(session);
const redis = new Redis(process.env.REDIS_URL);
app.set("trust proxy", 1);
app.use(
cors({
origin: process.env.CORS_ORIGIN,
credentials: true,
})
);
app.use(
@MohammedALREAI
MohammedALREAI / victory.tsx
Created September 21, 2021 05:45
victory example
import { gql, useMutation, useQuery, useSubscription } from "@apollo/client";
import React, { useEffect } from "react";
import { Helmet } from "react-helmet-async";
import { Link, useHistory, useParams } from "react-router-dom";
import { Dish } from "../../components/dish";
import {
VictoryAxis,
VictoryChart,
VictoryLabel,
VictoryLine,
@MohammedALREAI
MohammedALREAI / firebaseAuth.tsx
Created October 7, 2021 11:52
firebaseAuth with Context
/* eslint-disable @typescript-eslint/no-empty-function */
import React, { createContext, useEffect, useReducer } from 'react'
// third-party
import firebase from 'firebase/app'
import 'firebase/auth'
// action - state management
import { FIREBASE_STATE_CHANGED } from '../store/actions'
@MohammedALREAI
MohammedALREAI / permutation.js
Created November 24, 2021 12:34
HackerRnak permutation soluation
var result = []
function permutation(arr, currentSize) {
if (currentSize == 1) {
result.push(arr.join(""));
return;
}
for (let i = 0; i < currentSize; i++){
permutation(arr, currentSize - 1);