Skip to content

Instantly share code, notes, and snippets.

View deyvisonborges's full-sized avatar
🐙
I may be slow to respond.

Deyvison Borges deyvisonborges

🐙
I may be slow to respond.
View GitHub Profile
import { useState, useEffect, useCallback, MouseEvent, TouchEvent } from 'react'
import * as S from './styles'
export default function DraggableBottomSheet({ isOpen }: { isOpen: boolean }) {
const [open, setIsOpen] = useState(isOpen)
const [isAnimating, setIsAnimating] = useState(false) // Controle da animação
const [isDragging, setIsDragging] = useState(false)
const [startY, setStartY] = useState(0)
const [translateY, setTranslateY] = useState(0)
const [shouldClose, setShouldClose] = useState(false)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
html,
body {
import { Route, Redirect } from 'react-router-dom';
function App() {
const isAuthenticated = true; // Replace with actual authentication check
return (
<Router>
<Switch>
<Route exact path="/" component={HomePage} />
<Route exact path="/about" component={AboutPage} />
<Route exact path="/contact" component={ContactPage} />
// package com.mypackage.service.orders.app.persistence;
// import org.springframework.beans.factory.annotation.Qualifier;
// import org.springframework.boot.autoconfigure.domain.EntityScan;
// import org.springframework.boot.autoconfigure.orm.jpa.JpaProperties;
// import org.springframework.boot.jdbc.DataSourceBuilder;
// import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
// import org.springframework.context.annotation.Bean;
// import org.springframework.context.annotation.Configuration;
// import org.springframework.context.annotation.Primary;
/**
* Converter for converting a string CodeValue on the DTO into a Code object with type ITEM_TYPE_CODE
*/
Converter<String, Code> itemTypeCodeConverter = new Converter<String, Code>() {
public Code convert(MappingContext<String, Code> context) {
Code itemTypeCode = null;
for (Code code : ModelMapperExampleApplication.storedCodes) {
if (code.getCodeType().equals(ModelMapperExampleApplication.ITEM_TYPE_CODE)
&& code.getCodeValue().equals(context.getSource())) {
itemTypeCode = code;
@deyvisonborges
deyvisonborges / gist:6518f1dcba67269277c4c9615eaa12f3
Created January 24, 2024 08:01
Generate env by ambient with typescript
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require('fs')
const path = require('path')
const generateEnvFile = config => {
const envContent = Object.entries(config)
.map(([key, value]) => `${key}=${value}`)
.join('\n')
return envContent
// Implementation
export class UserRepository extends PrismaRepository<'user'> {}
import { PrismaClient } from '@prisma/client';
import { PrismaService } from '../integrations/prismaService';
export class PrismaRepository<
K extends Exclude<keyof PrismaClient, symbol | `$${string}`>,
> {
@deyvisonborges
deyvisonborges / stop-video.js
Created July 2, 2023 22:27 — forked from cferdinandi/stop-video.js
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
@deyvisonborges
deyvisonborges / reusable-fetchapi
Created April 4, 2022 20:00
Reusable FecthAPI Client
interface RequestOptions {
baseUrl?: string
prefix?: string
endpoint: string
config?: RequestInit
}
export async function request<T, TError>({
...props
}: RequestOptions): Promise<{
@deyvisonborges
deyvisonborges / gist:d99b832b9e418882962f20beaaeeb312
Last active March 26, 2022 06:40
Como isolar modelos no Prisma

Versão beta

Ainda vou aprimorar o código

Dentro da pasta prisma, criar uma pasta chamada schemas. No schemas, você pode criar seus modelos separados.

dentro do package.json

 "scripts": {