Skip to content

Instantly share code, notes, and snippets.


Abhi Aiyer abhiaiyer91

  • Workpop
  • Los Angeles
View GitHub Profile
View index.js
import { navigate } from "gatsby-link";
import * as React from "react";
import { useAuth } from "../hooks/useAuth";
const wrapper = {
backgroundColor: `rgb(197,250,3)`,
display: `flex`,
alignItems: `center`,
justifyContent: `center`,
flexDirection: `column`,
View login.js
import React from "react";
import { useAuth } from "../hooks/useAuth";
// .... other code .... //
export default function Login() {
const { login } = useAuth();
return (
<section style={wrapper}>
<div style={loginCard}>
View useAuth.js
import { navigate } from "gatsby-link";
import { useMoralis } from "./useMoralis";
export function useAuth() {
const { Moralis } = useMoralis();
return {
login: async () => {
try {
const user = await Moralis?.Web3.authenticate();
View useMoralis.js
export function useMoralis() {
// Moralis Initialization
let Moralis;
if (typeof window !== `undefined`) {
Moralis = require("moralis");
Moralis.serverURL = process.env.GATSBY_MORALIS_SERVER_ID;
return { Moralis };
View gatsby-browser.js
import Moralis from "moralis";
// Moralis Initialization
Moralis.serverURL = `YOUR_SERVER_URL`;
View login.js
import React from "react";
const wrapper = {
backgroundColor: `rgb(197,250,3)`,
display: `flex`,
alignItems: `center`,
justifyContent: `center`,
flexDirection: `column`,
height: `100vh`,
View testnet-stake-pool-metadata.json
"name": "Platform First Pool",
"description": "A pool dedicated to building applications on top of Cardano",
"ticker": "PLFM",
"homepage": ""
View error.logs
DEBUG: yarn.lock needs updating (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Updated 2 lock files (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
"updatedArtifacts": ["package-lock.json", "yarn.lock"]
DEBUG: 3 file(s) to commit (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Committing files to branch renovate/react-helmet-6.x (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
DEBUG: Error commiting files (repository=julienp-test-org/gatsby-starter-blog, branch=renovate/react-helmet-6.x)
"err": {
"task": {
"commands": [
View example-renovate.config.js
module.exports = {
/* endpoint: '', */
token: 'xxx',
platform: 'github',
logLevel: 'debug',
onboardingConfig: {
extends: ['config:base'],
repositories: ['julienp-test-org/gatsby-starter-blog'],
renovateFork: true,
View ticketStealing.js
// You're hosting an event, and the admission tickets are expensive. Groups of people are trying to cheat the system by using the same tickets multiple times. Stop them!
// 1) Create a constructor function called Ticket that takes one parameter, code, and creates a Ticket object.
// The Ticket object will have the following parameters:
// code : a string that stores the ticket code
// used : a boolean that stores whether or not the ticket has been used yet
// useTicket: a function registers that the ticket has been used and prevents reuse or tampering
// 2) Create a function called validTicket to check whether the ticket is valid and return true or false. For a ticket to be valid,
// the ticket code must match the correct code, and the ticket must be unused.