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
@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 / 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 / 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 / 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")
}
{
"compilerOptions": {
"outDir": "./lib",
"target": "es5",
"module": "esnext",
"baseUrl": ".",
"paths": {
"*": ["src/*"],
"@layout":["src/layout/*"],
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;
}
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 { 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 || '',
@MohammedALREAI
MohammedALREAI / simple.ts
Created June 1, 2021 16:09
JavaScript assignment 2‏
// call by value when you are used any the prmitive type like
// number ,string ,boolean ,undefined ,null like
// are always assigned/passed by
// value-copy: null, undefined, string, number, boolean, and ES6’s symbol.
// - First: Pass by value example
// some hint
// The original variable is not modified on changes in other variables.
let x=10;
@MohammedALREAI
MohammedALREAI / calcalater.ts
Created May 30, 2021 13:56
simple calcalater in ts
type Operation="+"|"-"|"*"|"/"
function calcalater(a:Array<number>=[1,2,3],b:Array<number>=[5,2,3],operation:Operation='-'){
let len=a.length>=b.length?a.length:b.length
let res:Array<number>=[]
for(let i=0;i<len;i++){
let first
let secand
if(operation==='+' ||operation==="-"){