This file contains hidden or 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
let contact = 'test', data, error; | |
const first = contact.substring(0, 1) | |
if (first === '+' || first === '(' || !isNaN(first)) { | |
//phone | |
console.log('testing phone') | |
const phone = contact.replace(/[+|-|(|)|.| ]/g, "").toLowerCase() | |
if (phone === "" || isNaN(phone)) { | |
error = "Please enter a proper phone number."; | |
} else if (phone.length < 10) { | |
error = "Your phone number is not long enough. Please include the Area Code."; |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Facebook Login Example</title> | |
<meta name="description" content="Facebook Login Example"> | |
<meta name="author" content="Matt Lockyer"> | |
</head> |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Facebook Login Example</title> | |
<meta name="description" content="Facebook Login Example"> | |
<meta name="author" content="Matt Lockyer"> | |
</head> |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>YouTube Search Example</title> | |
<meta name="description" content="YouTube Search Example"> | |
<meta name="author" content="Matt Lockyer"> | |
</head> |
This file contains hidden or 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 POST = (auth) => ({ | |
method: "POST", // *GET, POST, PUT, DELETE, etc. | |
mode: "cors", // no-cors, cors, *same-origin | |
headers: { | |
"Content-Type": "application/json", | |
...(auth ? { "Authorization": auth } : {}) | |
}, | |
}) |
This file contains hidden or 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
//example functions to set redux state of UI components | |
const {setDrawerState, setDialogState, setPopoverState} = ['Drawer', 'Dialog', 'Popover'].map((name) => ({ | |
['set' + name + 'State']: (state) => async (dispatch, getState) => { | |
const stateName = name.toLowerCase() + 'State' | |
const currentState = getState().appReducer[stateName] | |
dispatch({ type: 'UPDATE_UI_STATE', [stateName]: { ...currentState, ...state } }) | |
} | |
})).reduce((a, c) => ({...a, ...c})) | |
export { setDrawerState, setDialogState, setPopoverState } |
This file contains hidden or 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
//FROM HERE: https://stackoverflow.com/a/54123275/1060487 | |
// base64 to buffer | |
function base64ToBufferAsync(base64) { | |
var dataUrl = "data:application/octet-binary;base64," + base64; | |
fetch(dataUrl) | |
.then(res => res.arrayBuffer()) | |
.then(buffer => { | |
console.log("base64 to buffer: " + new Uint8Array(buffer)); |
This file contains hidden or 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 hidden or 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
/******************************** | |
* Module for generating and verifying JWT tokens | |
* Designed to work on Cloudflare Workers | |
* Should work in the browser or any env that supports Web Crypto API | |
********************************/ | |
/******************************** | |
* Key secret is a random Uint8Array of length 64 | |
* See below for instructions on generating random values / keys | |
********************************/ |
This file contains hidden or 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
SHARD0=https://api.s0.b.hmny.io | |
SHARD1=https://api.s1.b.hmny.io | |
SHARD2=https://api.s2.b.hmny.io | |
#your params | |
SHARD=SHARD1 | |
#example is HRC20 mint and transfer | |
TXID=0x039d2f87e6bdb81220e5a7490dc783ea835443f57f4e12d16d90dd0b3aa1f5af | |
#curl | |
curl -X POST $SHARD1 -H 'Accept: */*' -H 'Accept-Encoding: gzip, deflate' -H 'Cache-Control: no-cache' -H 'Connection: keep-alive' -H 'Content-Length: 162' -H 'Content-Type: application/json' -H 'Host: api.s1.b.hmny.io' -H 'Postman-Token: d5415117-657a-49f9-9100-a5b7ebc70daf,cc2f3cb9-2d10-408c-a003-d6e0822ec985' -H 'User-Agent: PostmanRuntime/7.19.0' -H 'cache-control: no-cache' -d '{ | |
"jsonrpc":"2.0", |