Skip to content

Instantly share code, notes, and snippets.

View dabit3's full-sized avatar
🎡
probably nothing

Nader Dabit dabit3

🎡
probably nothing
View GitHub Profile
@dabit3
dabit3 / demoday.md
Last active November 6, 2024 11:57
How to Give a Killer Pitch or Hackathon Demo
@dabit3
dabit3 / page.tsx
Created April 4, 2024 14:08
Next.js + Capsule example
'use client'
import Capsule, {
Environment,
CapsuleModal,
} from '@usecapsule/react-sdk';
import { useState, useEffect } from 'react'
const capsule = new Capsule(
Environment.BETA,
@dabit3
dabit3 / page.tsx
Created December 1, 2023 22:28
Fal + Next.js Real Time with Websockets
'use client'
import { useState } from 'react'
import { Input } from '@/components/ui/input'
import * as fal from "@fal-ai/serverless-client";
import { Excalidraw, exportToBlob } from "@excalidraw/excalidraw";
import Image from 'next/image'
fal.config({
proxyUrl: "/api/fal/proxy",
})
@dabit3
dabit3 / react-native-walletconnectmodal.js
Last active October 6, 2023 03:02
React Native WalletConnectModal Example
/*
* Resources
* Medium: https://medium.com/walletconnect/how-to-build-a-react-native-dapp-with-walletconnect-28f08f332ed7
* YouTube: https://www.youtube.com/watch?v=mGtEPQfqMV8
* Docs: https://docs.walletconnect.com/2.0/advanced/walletconnectmodal/about?platform=react-native
*/
import { WalletConnectModal, useWalletConnectModal } from "@walletconnect/modal-react-native"
import { StyleSheet, Text, View, TouchableHighlight } from "react-native"
const projectId = 'my-project-id' // see https://cloud.walletconnect.com/
@dabit3
dabit3 / app.ts
Last active July 3, 2023 23:14
AI Functions Frontend
'use client'
import { useState } from 'react'
export default function Home() {
const [input, setInput] = useState('')
const [image, setImage] = useState('')
const [audio, setAudio] = useState('')
const [text, setText] = useState('')
const [loading, setLoading] = useState(false)
async function callApi() {
@dabit3
dabit3 / ai-functions.ts
Last active July 3, 2023 23:04
Base example of GPT functions in TypeScript
import { NextRequest, NextResponse } from 'next/server'
import Replicate from 'replicate'
const replicate = new Replicate({
auth: process.env.REPLICATE_TOKEN || ''
})
const KEY = process.env.OPENAI_API_KEY || ''
const base_uri = 'https://api.openai.com/v1/chat/completions'
@dabit3
dabit3 / upload.js
Created May 14, 2023 02:10
upload - upload component
// const ipfs = ipfsClient(); // Connect to the local IPFS API
import { create } from 'ipfs-http-client'
import { Buffer } from 'buffer'
/* configure Infura auth settings */
const projectId = ""
const projectSecret = ""
const auth = 'Basic ' + Buffer.from(projectId + ':' + projectSecret).toString('base64')
@dabit3
dabit3 / main.js
Created May 14, 2023 02:09
Upload main component
import React from "react";
import LoginButton from "../components/LoginButton";
import LogoutButton from "../components/LogoutButton";
import {uploadJson} from "../components/upload";
import {
ContentFocus, ProfileOwnedByMe,useActiveWallet, useActiveProfile, useCreatePost, useExploreProfiles
} from '@lens-protocol/react-web';
async function upload(content) {
const data = await uploadJson(content)
@dabit3
dabit3 / deploy-lens.sh
Last active October 16, 2022 02:24
Deploying Lens Protocol with Hardhat
git clone [email protected]:lens-protocol/core.git
cd lens-protocol
touch .env
npm install
npm run compile
# in a new terminal window
npx hardhat node
# in the original terminal window
@dabit3
dabit3 / Call.t.sol
Created June 26, 2022 18:47
Testing calling another contract with Foundry / Solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import 'src/Call.sol';
contract AuctionTest is Test {
Call callContract;
TestCall tCallContract;