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
#!/bin/bash | |
#this is a script for starting, stopping, syncing, and deploying the workers | |
kill_rogue_processes() { | |
echo "Killing database worker" | |
kill -9 $(lsof -t -i:8787) 2>/dev/null | |
echo "Killing jwt worker" | |
kill -9 $(lsof -t -i:8788) 2>/dev/null | |
echo "Killing email worker" | |
kill -9 $(lsof -t -i:8789) 2>/dev/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
//overide the image handler, this is using quill but it will work with any richtext editor. | |
var toolbar = quill.getModule('toolbar'); | |
toolbar.addHandler('image', showImageUI); | |
let saveToServer = (file) => { | |
//get the data | |
const fd = new FormData(); | |
fd.append('image', file); | |
//send it ot the server | |
const xhr = new XMLHttpRequest(); |
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
/** | |
STEPS | |
sign up for a postmark account here | |
https://postmarkapp.com/ | |
verify an email. I used email cloudflare email routing to make this easy |
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 swan. | |
const swan = require('@swan-bitcoin/xpub-lib'); | |
export async function onRequestGet(context) { | |
//build the paramaters | |
const { | |
request, // same as existing Worker API | |
env, // same as existing Worker API | |
params, // if filename includes [id] or [[path]] | |
waitUntil, // same as ctx.waitUntil in existing Worker API |
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
//test data | |
//xpub converted from electrum using https://jlopp.github.io/xpub-converter/ | |
const xpub = | |
'xpub67yMUMbr2gAnBgnYvXcbJq8iUBe54Ev2dbUYKGN8jGY21AHJFeR7mnZqhbUNze4UbpRE9S1fWvmFCsFN4EvU1rWdqegW7dzoa7vZmYCLAAy'; | |
//xpub from electrum https://www.poof.io/help/wallet/electrum | |
const zpub = "zpub6mdt5gwgL3FjtHAnbFBqj1Kip7vxwUu2TpWyt49uVHHn7MukkxkF1ut7k1PYzTNKR6eqePCnSFULySUVVdkVcKsqaL5MHTdn7a3rYdSEc2K"; | |
//different xpubs for testing taking from https://github.com/peli-pro/coldcard_address_generator/blob/master/coldcard_address_generator_node.js | |
const xpub_44h_0h_0h = 'xpub6BosfCnifzxcFwrSzQiqu2DBVTshkCXacvNsWGYJVVhhawA7d4R5WSWGFNbi8Aw6ZRc1brxMyWMzG3DSSSSoekkudhUd9yLb6qx39T9nMdj'; | |
const xpub_49h_0h_0h = 'xpub6C6nQwHaWbSrzs5tZ1q7m5R9cPK9eYpNMFesiXsYrgc1P8bvLLAet9JfHjYXKjToD8cBRswJXXbbFpXgwsswVPAZzKMa1jUp2kVkGVUaJa7'; | |
const xpub_84h_0h_0h = 'xpub6CatWdiZiodmUeTDp8LT5or8nmbKNcuyvz7WyksVFkKB4RHwCD3XyuvPEbvqAQY3rAPshWcMLoP2fMFMKHPJ4ZeZXYVUhLv1VMrjPC7PW6V'; |
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
This gist aims to show you how to use KV datastore using Cloudflare pages. The reason I created this quick guide is it took | |
me almost 2 weeks to get it working, mainly because it is very new and the documentation is not up fully fleshed out yet | |
https://developers.cloudflare.com/workers/runtime-apis/kv | |
https://developers.cloudflare.com/pages/platform/functions | |
https://blog.cloudflare.com/wrangler-v2-beta/ | |
Steps: | |
Install wrangler 2 |
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 THE ELEVENTY API FILE | |
const superagent = require('superagent'); | |
let env = require('./env') | |
//this function gets some date from and API which can be used in the data processing, for simpluicty stakes it is connection to our auctions endpoint so you can see | |
//it in action |
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
//API Data preprocessing can happen here | |
const superagent = require('superagent'); | |
let env = require('./env') | |
//this function gets some date from and API which can be used in the data processing, for simpluicty stakes it is connection to our auctions endpoint so you can see | |
//it in action | |