Skip to content

Instantly share code, notes, and snippets.

View polluterofminds's full-sized avatar

Justin Hunter polluterofminds

View GitHub Profile
Verifying my Blockstack ID is secured with the address 16KyUebBPPXgQLvA1f51bpsne3gL7Emdrc https://explorer.blockstack.org/address/16KyUebBPPXgQLvA1f51bpsne3gL7Emdrc
Verifying my Blockstack ID is secured with the address 1CiUwPYym8VKeKppDKSuRVRAyHNaJdySSG https://explorer.blockstack.org/address/1CiUwPYym8VKeKppDKSuRVRAyHNaJdySSG
import { lookupProfile } from 'blockstack';
require('dotenv').config()
const config = require('./config.json');
const request = require('request-promise');
const { InstanceDataStore } = require('blockstack/lib/auth/sessionStore');
const { connectToGaiaHub } = require('blockstack/lib/storage/hub');
const { AppConfig, UserSession } = require('blockstack');
let idAddress;
let configObj;
@polluterofminds
polluterofminds / index.js
Last active January 11, 2021 16:07
Pinnie For Your Thought Entry File
import Head from "next/head";
import Link from "next/link";
import Image from "next/image";
export default function Home() {
return (
<div>
<Head>
<title>Pinnie For Your Thoughts</title>
<link rel="icon" href="/pinnie.svg" />
@polluterofminds
polluterofminds / index.js
Last active January 11, 2021 16:18
index.js styles
const styles = {
header: {
display: "flex",
flexDirection: "row",
width: "100vw",
justifyContent: "flex-end",
paddingRight: "10px",
paddingTop: 10,
},
flex: {
@polluterofminds
polluterofminds / sample.js
Created January 7, 2021 19:56
Sample Blog Post
import React, { useState, useEffect } from "react";
import ReactMarkdown from "react-markdown";
import axios from "axios";
import { useRouter } from "next/router";
import Link from "next/link";
const Sample = () => {
const [content, setContent] = useState(null);
const router = useRouter();
const { sid } = router.query;
@polluterofminds
polluterofminds / index.js
Created January 11, 2021 17:39
handleSubmit
const handleSubscribe = async (e) => {
e.preventDefault();
try {
await subscribe(email);
setSuccessMessage("Check your email to continue!");
setEmail("");
} catch (error) {
setError(error.message);
}
}
@polluterofminds
polluterofminds / index.js
Created January 11, 2021 17:44
error and success
<div style={styles.flexRow}>
<form onSubmit={handleSubscribe}>
<input
style={styles.input}
onChange={(e) => setEmail(e.target.value)}
value={email}
type="email"
placeholder="Type your email"
/>
<button type="submit" style={styles.btn}>
@polluterofminds
polluterofminds / subscribe.js
Last active January 13, 2021 17:59
subscribe to posts
import axios from "axios";
import jwt from "jsonwebtoken";
const sgMail = require('@sendgrid/mail');
sgMail.setApiKey("SENDGRID API KEY");
const SECRET = "MY SUPER SECRET SIGNING KEY";
const config = {
headers: {
Authorization:
"Bearer PINATA JWT",
"Content-Type": "application/json",
import { checkSubscriptions, createJWT, sendEmail } from "./subscribe";
export default async (req, res) => {
try {
// Check for existing subscription
const existingSubscription = await checkSubscriptions(req.body.email);
if (!existingSubscription) {
return res.status(400).send("User is not subscribed");
}