Skip to content

Instantly share code, notes, and snippets.

View stevedylandev's full-sized avatar
🌐
blogging and building

Steve Simkins stevedylandev

🌐
blogging and building
View GitHub Profile
@stevedylandev
stevedylandev / Aerial.js
Last active April 19, 2022 15:38
Aerial Component
import { useEffect } from "react";
import axios from "axios";
const Aerial = () => {
const getEmissionsData = async () => {
try{
const response = await axios.get("https://aerial.is/_nft/0x2acab3dea77832c09420663b0e1cb386031ba17b")
console.log(response.data)
} catch (error) {
@stevedylandev
stevedylandev / Aerial.js
Created April 20, 2022 00:59
Aerial Component
import { useState, useEffect } from "react"
import axios from "axios"
const Aerial = () => {
const [emissionsData, setEmissionsData] = useState([])
const [isLoading, setIsLoading] = useState(false)
const getEmissionsData = async () => {
try{
@stevedylandev
stevedylandev / Aerial.js
Created April 20, 2022 14:56
Aerial Component
import { useState, useEffect } from "react"
import "./Aerial.css"
import axios from "axios";
import Lottie from "react-lottie"
import co2 from "./co2.json"
const Aerial = () => {
const [emissionsData, setEmissionsData] = useState([])
@stevedylandev
stevedylandev / FileUpload.js
Created April 27, 2022 15:57
Pinata React Upload Component
import { useState } from "react"
import axios from "axios"
const FileUpload = () => {
const [selectedFile, setSelectedFile] = useState();
const changeHandler = (event) => {
setSelectedFile(event.target.files[0]);
};
@stevedylandev
stevedylandev / unpins.js
Last active December 20, 2023 16:57
This script will unpin all files from your Pinata account! You can alter the PIN_QUERY to adjust it if you only want to delete a range of files
const PINATA_JWT = 'Bearer YOUR_JWT_HERE'
const PIN_QUERY = `https://api.pinata.cloud/data/pinList?status=pinned&pageLimit=1000&includeCount=false`
const fetch = require('node-fetch')
const wait = (milliseconds) => {
return new Promise((resolve) => {
setTimeout(resolve, milliseconds);
});
};
@stevedylandev
stevedylandev / App.js
Created June 14, 2022 01:03
IPFS Image Optimization
import './App.css';
function App() {
let imageIds = []
for (let id = 1; id <= 8; id++){
imageIds.push(id)
}
@stevedylandev
stevedylandev / uploadFolder.js
Created June 25, 2022 15:05
Upload a Folder with Pinata API
import fs from "fs"
import FormData from "form-data"
import rfs from "recursive-fs"
import basePathConverter from "base-path-converter"
import got from 'got'
const pinDirectoryToPinata = async () => {
const url = `https://api.pinata.cloud/pinning/pinFileToIPFS`;
const src = "PATH_TO_FOLDER";
var status = 0;
@stevedylandev
stevedylandev / FolderUpload.js
Created July 19, 2022 11:06
A React component for uploading folders to Pinata
import { useState } from "react"
import axios from "axios"
const FolderUpload = () => {
const [selectedFile, setSelectedFile] = useState();
const changeHandler = (event) => {
setSelectedFile(event.target.files);
};
@stevedylandev
stevedylandev / getShortLink.js
Last active September 27, 2022 01:00
A function that will let users get the short link of a pin
@stevedylandev
stevedylandev / uploadFromSteam.js
Last active November 17, 2022 17:52
A function that will upload to Pinata through a buffer
const axios = require("axios");
const axiosRetry = require("axios-retry");
const FormData = require("form-data");
const jwt = `Bearer PASTE_YOUR_JWT`
const uploadToPinata = async (sourceUrl) => {
const axiosInstance = axios.create();