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 files = [ | |
'js/cash.js', | |
'js/component.js', | |
'js/global.js', | |
'js/anime.min.js', | |
// 'js/collapsible.js', | |
// 'js/dropdown.js', | |
// 'js/modal.js', |
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
// set the network (if you want mainnet) | |
export NEAR_ENV=mainnet | |
// choose 1 or 2 | |
// 1. NEAR wallet login | |
near login | |
// 2. LEDGER replace ACCOUNT_ID | |
// change useLedgerKey value if you are using custom ledger path | |
near repl --accountId="ACCOUNT_ID" --useLedgerKey="44'/397'/0'/0'/1'" | |
// REPL |
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
export const get = (k, d = {}) => { | |
let v = localStorage.getItem(k) | |
try { | |
return JSON.parse(v || JSON.stringify(d)) | |
} catch (e) { | |
return v | |
} | |
} | |
export const set = (k, v) => localStorage.setItem(k, typeof v === 'string' ? v : JSON.stringify(v)) | |
export const del = (k) => localStorage.removeItem(k) |
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
Use square image or 1200x628 | |
<head> | |
<meta property="og:title" content=""> | |
<meta property="og:image" content=""> | |
<meta property="og:type" content="website"> | |
<meta name="twitter:card" content="summary_large_image"> | |
<meta name="twitter:site" content="@mattdlockyer"> | |
<meta name="twitter:creator" content="@mattdlockyer"> | |
<meta property="twitter:image:alt" 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
THREE.NoBlending = 0; | |
THREE.NormalBlending = 1; | |
THREE.AdditiveBlending = 2; | |
THREE.SubtractiveBlending = 3; | |
THREE.MultiplyBlending = 4; | |
THREE.CustomBlending = 5; | |
How to change it: | |
var material = new THREE.BasicMaterial({ |
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
modal = document.createElement('div') | |
modal.innerHTML = '<span id="close-modal">x</span>' | |
style = modal.style | |
modal.style.zIndex = 1000 | |
modal.style.width = modal.style.height = '90%' | |
modal.style.background = 'white' | |
modal.style.position = 'absolute' | |
modal.style.top = modal.style.left = '5%' | |
modal.style.padding = '16px' | |
document.body.appendChild(modal) |
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
/******************************** | |
* GA data | |
********************************/ | |
let data = { | |
v: 1, | |
} | |
/******************************** | |
* Initializes GA data | |
* @param {string} tid your tracking id for GA | |
* @param {object} req the request object from event.request |
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 React, { useContext, useEffect } from 'react'; | |
import { store } from './state/store'; | |
import { onMount } from './state/test'; | |
const ExampleComponent = () => { | |
const { state, dispatch, update: updateStore } = useContext(store) | |
console.log(state) | |
const update = async () => { | |
// dispatch thunk wraps function with state, dispatch | |
const res = await dispatch(initNear()) |
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 * as nearlib from 'near-api-js' | |
const contractBytes = await fetch('./contract.wasm').then((r) => r.arrayBuffer()) | |
const hash = await crypto.subtle.digest('SHA-256', contractBytes) | |
const hash58 = nearlib.utils.serialize.base_encode(hash) | |
console.log(hash58) |
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 { lock, unlock } from './mutex.js' | |
async function processCallsLikeQueue() { | |
// stop method calls here | |
await lock('processCallsLikeQueue()') | |
// ... | |
// code to protect from re-entry | |
// i.e. prevent multiple simultaneous calls to this part of the code | |
// ... | |
// let next method call in |