Skip to content

Instantly share code, notes, and snippets.

View donvito's full-sized avatar
🚀
solo dev building apps with AI. launched aidreamphoto.com

Melvin Vivas @DonvitoCodes donvito

🚀
solo dev building apps with AI. launched aidreamphoto.com
View GitHub Profile
@donvito
donvito / security-coding-practices.mdc
Created April 26, 2025 03:58
Cursor Rules for Securing your app
# Secure Coding Practices
## Input Validation
- Always validate user input on both client and server sides
- Never trust client-side validation alone
- Use validation libraries appropriate for your framework (e.g., Zod, Joi, Yup)
## Prevent SQL Injection
[
{ "title": "Pricing Component", "generationId": "rRBlufM", "author": "Steven Tey" },
{ "title": "Health Charts", "generationId": "R3W5UMZB50j", "author": "shadcn" },
{ "title": "Hero Section", "generationId": "0W13RkH", "author": "shadcn" },
{ "title": "Weather App", "generationId": "bo2N7pU", "author": "Alice Johnson" },
{ "title": "Login Screen", "generationId": "CZIY9QmU1We", "author": "Bob Brown" },
{ "title": "Login Screen", "generationId": "yK24QpZ6ECp", "author": "Charlie Davis" },
{ "title": "Course Video", "generationId": "Jg1C9YuOYKp", "author": "Diana Evans" }
]
@donvito
donvito / main.py
Last active August 15, 2024 06:13
OpenAI Structured Output Example - Study Plan Generator
from pydantic import BaseModel
from typing import List, Optional
from openai import OpenAI
import json
from pydantic import BaseModel
from typing import List, Optional
from output_generators import generate_html, generate_pdf
@donvito
donvito / page.tsx
Created September 21, 2023 07:01
client code
'use client';
import { Textarea } from "@/components/ui/textarea"
import { Button } from "@/components/ui/button"
import { useChat } from 'ai/react';
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import Footer from "../footer";
import { renderContent } from "../message-response/messageUtils";
//for mocking to test the UI
@donvito
donvito / query-notion-page.py
Last active August 25, 2023 14:02
llama_index examples
import logging
import sys
import openai
logging.basicConfig(stream=sys.stdout, level=logging.INFO)
logging.getLogger().addHandler(logging.StreamHandler(stream=sys.stdout))
from llama_index.llms import OpenAI
from llama_index import ListIndex, NotionPageReader, ServiceContext
import os
@donvito
donvito / api_chain_example.ipynb
Last active April 24, 2024 12:44
api_chain_one_map_api_example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donvito
donvito / llama_index_public.ipynb
Created April 8, 2023 06:58
llama_index_public.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@donvito
donvito / main.go
Last active November 26, 2022 03:41
Hello World
// This is a comment
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
@donvito
donvito / contracts...Wallet.sol
Created August 29, 2021 10:17
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0 <0.9.0;
contract SampleContractWallet{
mapping(address => uint256) public balances;
address payable wallet;
constructor(address payable _wallet) {
wallet = _wallet;
@donvito
donvito / contracts...MyContract.sol
Created August 29, 2021 06:24
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.0+commit.c7dfd78e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.0 <0.9.0;
contract MyContract{
address owner;
string public mobileNo;
modifier onlyOwner(){
require(msg.sender == owner);