This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { v4 as uuidv4 } from "uuid"; | |
import { NextApiRequest, NextApiResponse } from "next"; | |
import { Session } from "next-iron-session"; | |
import { addressCheckMiddleware, pinataApiKey, pinataSecretApiKey, withSession } from "./utils"; | |
import FormData from "form-data"; | |
import axios from "axios"; | |
type FileReq = { | |
bytes: Uint8Array; | |
contentType: string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from turtle import Turtle, Vec2D | |
class Text(Turtle): | |
def __init__(self, text: str, pos: Vec2D ): | |
super().__init__() | |
self.color('white') | |
self.penup() | |
self.setpos(pos) | |
self.hideturtle() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NAMESPACE = "https://portfolio-jerga.com" | |
const ROLES = { | |
"jerga99@gmail.com": ["admin"] | |
} | |
export default async function getRole(req, res) { | |
try { | |
const email = req.query?.email | |
const role = ROLES[email] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NAMESPACE = "https://portfolio-jerga.com" | |
const ROLES = { | |
"jerga99@gmail.com": ["admin"] | |
} | |
export default async function getRole(req, res) { | |
try { | |
const email = req.query?.email | |
if (email) { | |
const role = ROLES[email] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import useSWR from 'swr'; | |
import { fetcher } from '@/actions'; | |
export const useGetUser = () => { | |
const { data, error, ...rest} = useSWR('/api/v1/me', async (url) => { | |
const data = await fetcher(url) | |
const res = await fetch(`/api/v1/roles?email=${data.email}`) | |
const roles = await res.json() | |
return {...data, ...roles} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
num_1 = 100 | |
num_2 = 50 | |
num_3 = 25 | |
f_name = 'Filip' | |
l_name = 'Doe' | |
result_1 = (num_2 < num_1) and (num_3 < num_2) and (num_2 > num_1) | |
result_2 = (num_1 >= num_2) or (num_3 != num_2) or (num_1 == 100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const purchaseCourse = async (order) => { | |
let hexCourseId = web3.utils.utf8ToHex(selectedCourse.id); | |
while (hexCourseId.slice(2).length < 32) { | |
hexCourseId += "0"; | |
} | |
const orderHash = web3.utils.soliditySha3( | |
{ type: "bytes16", value: hexCourseId }, | |
{ type: "address", value: account.data } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "frontend", | |
"proxy": "http://localhost:5000", | |
"version": "0.1.0", | |
"private": true, | |
"dependencies": { | |
"@metamask/detect-provider": "^2.0.0", | |
"@paypal/paypal-js": "^5.0.5", | |
"@testing-library/jest-dom": "^5.16.2", | |
"@testing-library/react": "^12.1.2", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable jsx-a11y/anchor-is-valid */ | |
import React from "react"; | |
import RentalCard from "../components/rental/RentalCard"; | |
import { connect } from "react-redux"; | |
class RentalHome extends React.Component { | |
state = { | |
rentals: [], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { BrowserRouter as Router } from "react-router-dom"; | |
import Header from "./components/shared/Header"; | |
import RentalRoutes from "./rentalRoutes"; | |
import { initStore } from "./store"; | |
import { Provider } from "react-redux"; | |
const store = initStore(); | |
function App(props: any) { | |
return ( |