Skip to content

Instantly share code, notes, and snippets.

View YuriFontella's full-sized avatar
💭
sad dev

Yuri Fontella YuriFontella

💭
sad dev
  • Porto Alegre - RS
View GitHub Profile
@YuriFontella
YuriFontella / tortoise-library.py
Last active March 1, 2024 18:30
relationship prefetch related name
import asyncio
from tortoise import Tortoise, fields
from tortoise.connection import connections
from tortoise.models import Model
class Author(Model):
id = fields.IntField(pk=True)
name = fields.CharField(max_length=255)
import httpx
import asyncio
from fastapi import FastAPI, Request
from tortoise import Tortoise, Model, fields, connections
from WPP_Whatsapp import Create
from urllib.parse import parse_qs
from contextlib import asynccontextmanager
sudo apt install libedit-dev libssl-dev libffi-dev lzma bzip2 sqlite3 zlib1g-dev build-essential
curl https://pyenv.run | bash
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
pyenv install 3.12.2
const xlsx = require('xlsx')
const { Writable, Transform } = require('stream')
const fs = require('fs')
const path = require('path')
console.log('início')
const workbook = xlsx.readFile('data-600.xlsx', { sheetStubs: true })
@YuriFontella
YuriFontella / http.js
Last active December 4, 2022 21:45
composable axios vue
import { inject, reactive, toRefs } from 'vue'
import { Cookies, Notify } from 'quasar'
export function useHttp() {
const state = reactive({
loading: false, data: null
})
(async () => {
console.time()
async function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms))
}
const time = 2000
const total = 2
//EMBEDD THE FRESHDESK MESSAGING MESSENGER CODE ON YOUR WEBSITE
// Start talking to your website visitors by embedding this code on your website. Remember, nothing will work until you do.
// Add the following script to your website's HTML source code before the end of the BODY tag. Add the script to each page where you want the messenger to appear. For setup instructions, see the
// Docs - https://freshchat.readthedocs.io/en/latest/intro.html
<script>
function initFreshChat() {
window.fcWidget.init({
[
{
"id": "01coin",
"symbol": "zoc",
"name": "01coin"
},
{
"id": "0-5x-long-algorand-token",
"symbol": "algohalf",
"name": "0.5X Long Algorand Token"
@YuriFontella
YuriFontella / app.js
Created May 25, 2021 22:17
nextjs-graphql-request
import Head from 'next/head'
import { GraphQLClient, gql } from 'graphql-request'
import { useState, useEffect } from 'react'
const Home = () => {
const [data, setData] = useState()
const endpoint = 'http://localhost:4000/graphql'
@YuriFontella
YuriFontella / server.js
Last active May 28, 2021 05:54
graphql schemas and resolvers with auth
'use strict'
const Fastify = require('fastify')
const mercurius = require('mercurius')
const auth = require('mercurius-auth')
const { ErrorWithProps } = mercurius
const app = Fastify()