This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Head from 'next/head'; | |
import Layout from '@/components/Layout'; | |
import { useForm } from 'react-hook-form'; | |
import { | |
getUser, | |
withPageAuth, | |
supabaseServerClient, | |
} from '@supabase/auth-helpers-nextjs'; | |
import { supabase } from '@/lib/supabaseClient'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require('fs'); | |
const starknet = require('starknet'); | |
const { ec, defaultProvider, json, Contract } = starknet; | |
const starkKeyPair = ec.getKeyPair(user.privateKey); | |
const starkKeyPub = ec.getStarkKey(starkKeyPair); | |
const compiledArgentAccount = json.parse(fs.readFileSync('./utils/ArgentAccount.json').toString('ascii')); | |
const accountResponse = await defaultProvider.deployContract({ | |
contract: compiledArgentAccount, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const hre = require('hardhat'); | |
const zksync = require('zksync'); | |
const GOVERNANCE_RINKEBY = '0xC8568F373484Cd51FDc1FE3675E46D8C0dc7D246'; | |
const NFT_CONTRACT = '0x6B1b6167B423505CCa1265Bf9E64AC6bd374Ea9e'; // deployed contract address | |
async function main() { | |
const NFTContract = await hre.ethers.getContractFactory('NFTContract'); | |
const ethersProvider = new hre.ethers.getDefaultProvider('rinkeby'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect, useRef } from "react"; | |
const useWatchLocation = (options = {}) => { | |
// store location in state | |
const [location, setLocation] = useState(); | |
// store error message in state | |
const [error, setError] = useState(); | |
// save the returned id from the geolocation's `watchPosition` to be able to cancel the watch instance | |
const locationWatchId = useRef(null); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState, useEffect } from "react"; | |
const useCurrentLocation = (options = {}) => { | |
// store location in state | |
const [location, setLocation] = useState(); | |
// store error message in state | |
const [error, setError] = useState(); | |
// Success handler for geolocation's `getCurrentPosition` method | |
const handleSuccess = (pos) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from 'react'; | |
import { put } from 'axios'; | |
const useUploadFileToS3 = () => { | |
const [uploadProgress, setUploadProgress] = useState(0); | |
const [isUploading, setIsUploading] = useState(false); | |
const [isSuccessful, setIsSuccessful] = useState(false); | |
const uploadFileToS3 = (fileData, s3URL) => { | |
setIsUploading(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.clear(); | |
const cart = [ | |
{price: 12, amount: 1}, | |
{price: 7.5, amount: 2}, | |
{price: 8, amount: 4} | |
]; | |
const total = [...cart].reduce((total, { amount, price }) => { | |
return (total += amount * price); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("DOMContentLoaded", function() { | |
var lazyloadImages; | |
if ("IntersectionObserver" in window) { | |
lazyloadImages = document.querySelectorAll(".lazy"); | |
var imageObserver = new IntersectionObserver(function(entries, observer) { | |
entries.forEach(function(entry) { | |
if (entry.isIntersecting) { | |
var image = entry.target; | |
image.src = image.dataset.src; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const statusCodes = { | |
'100': 'Continue', | |
'101': 'Switching Protocols', | |
'102': 'Processing', | |
'200': 'OK', | |
'201': 'Created', | |
'202': 'Accepted', | |
'203': 'Non-Authoritative Information', | |
'204': 'No Content', | |
'206': 'Partial Content', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// D1 average tempo and D1 average efficiency vary daily but this is what I have for 1/28/18 | |
const D1AverageTempo = 68.3185185185185 // the average tempo of all Division1 teams | |
const D1AverageEfficiency = 104.07578347578351 // the average combined offensive and defensive efficiency of all Division1 teams | |
const offensiveWeight = 1.014; // Offensive weight for the home team | |
const defensiveWeight = 0.986; // Defensive weight for the home team | |
const awayOffensiveEfficiency = awayOffensiveEfficiency * defWeight; | |
const awayDefensiveEfficiency = awayDefensiveEfficiency * offWeight; |
NewerOlder