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
// In production, we register a service worker to serve assets from local cache. | |
// This lets the app load faster on subsequent visits in production, and gives | |
// it offline capabilities. However, it also means that developers (and users) | |
// will only see deployed updates on the "N+1" visit to a page, since previously | |
// cached resources are updated in the background. | |
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy. | |
// This link also includes instructions on opting out of this behavior. |
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
// store/index.js | |
const createStore = () => { | |
return new Vuex.Store({ | |
state: { | |
counter: 0, | |
repos: [] | |
}, | |
actions: { | |
LOAD_REPOS: function({ commit }) { | |
axios.get('url').then((res) => { |
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; |
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
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
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
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
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, 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
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'); |
OlderNewer