Skip to content

Instantly share code, notes, and snippets.

View polluterofminds's full-sized avatar

Justin Hunter polluterofminds

View GitHub Profile
@polluterofminds
polluterofminds / MobileView.js
Created October 26, 2022 15:49
Appjections Mobile View
import React, { useEffect, useState } from 'react'
import InstallScreen from "./InstallScreen";
import AppContainer from "./AppContainer";
const MobileView = () => {
const [standaloneMode, setStandaloneMode] = useState(false);
useEffect(() => {
let standalone = false;
if (window.matchMedia("(display-mode: standalone)").matches) {
standalone = true;
@polluterofminds
polluterofminds / App.js
Created October 26, 2022 15:39
App.js for progressive web app
import React, { useEffect, useState } from "react";
import "./App.css";
import MobileView from "./components/MobileView";
import DesktopView from "./components/DesktopView";
function App() {
const [mobile, setMobile] = useState(true);
useEffect(() => {
const isMobile = () =>
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
@polluterofminds
polluterofminds / index.html
Last active October 21, 2022 19:28
Twitter Instant Game index.html with body start
<style type="text/css">
body {
max-width: 85%;
margin: auto;
}
iframe {
width: 100%;
height: 100vh;
}
#locked {
@polluterofminds
polluterofminds / index.html
Last active October 21, 2022 14:12
Initial twitter embed index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="twitter:card" content="player" />
<meta name="twitter:site" content="@polluterofminds" />
<meta name="twitter:title" content="Pinata Instant Games" />
<meta
name="twitter:description"
@polluterofminds
polluterofminds / artist.js
Last active October 3, 2022 15:14
SoundBasket artist.js POST
import { MongoClient } from "mongodb";
const uri = process.env.MONGO_URI;
const client = new MongoClient(uri);
export default async function handler(req, res) {
if (req.method === "POST") {
try {
const database = client.db("pinata");
const artists = database.collection("artists");
@polluterofminds
polluterofminds / AppNFT.js
Last active August 18, 2022 18:55
App NFT test
const { expect } = require("chai");
const URI = "ipfs://QmTXCPCpdruEQ5HspoTQq6C4uJhP4V66PE89Ja7y8CEJCw";
const URI2 = "ipfs://QmTXCPwpdruEQ5HBpoTQq6C4uJhP4V66PE89Ja7y8CEJC2"
describe("AppNFT", function () {
async function deploy() {
const [owner, otherAccount] = await ethers.getSigners();
const AppNFT = await ethers.getContractFactory("AppNFT");
const appNft = await AppNFT.deploy(URI);
@polluterofminds
polluterofminds / Authenticate.js
Created July 16, 2022 15:45
Authenticate Page Ghost NFT Gated Blog
import React, { useEffect, useState } from "react";
import { useAccount, useConnect, useSignMessage, useDisconnect } from 'wagmi';
const Authenticate = ({ cid, setPostContent, setAuthenticated }) => {
const [mounted, setMounted] = useState(false)
const [messageId, setMessageId] = useState(null);
const [signature, setSignature] = useState(null);
useEffect(() => {
if(messageId && signature) {
@polluterofminds
polluterofminds / Skeleton.js
Created July 14, 2022 19:38
Skeleton Blog Post Loading Screen
import React from "react";
const Skeleton = () => {
return (
<div className="card">
<div className="header">
<div className="img"></div>
<div className="details">
<span className="name"></span>
<span className="about"></span>
@polluterofminds
polluterofminds / index.js
Created July 14, 2022 19:26
Pinata Blog Home Page
import Head from 'next/head'
import { useState, useEffect } from 'react'
import Posts from '../components/Posts'
import Skeleton from '../components/Skeleton';
export default function Home({ data }) {
const [posts, setPosts] = useState([])
const [loading, setLoading] = useState(true);
const [offset, setOffset] = useState(0);
const [limit, setLimit] = useState(10);
@polluterofminds
polluterofminds / MintPinataParty.cdc
Created February 26, 2021 18:04
PinataParty Minting Transaction
import PinataPartyContract from 0xf8d6e0586b0a20c7
transaction {
let receiverRef: &{PinataPartyContract.NFTReceiver}
let minterRef: &PinataPartyContract.NFTMinter
prepare(acct: AuthAccount) {
self.receiverRef = acct.getCapability<&{PinataPartyContract.NFTReceiver}>(/public/NFTReceiver)
.borrow()
?? panic("Could not borrow receiver reference")