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, useCallback } from 'react'; | |
import { onSnapshot, queryEqual } from 'firebase/firestore'; | |
import useMemoCompare from './UseMemoCompare'; | |
// Get doc data and merge doc.id and doc.ref | |
function getDocData(doc) { | |
return doc.id ? { id: doc.id, ref: doc.ref, ...doc.data() } : null; | |
} | |
// Get array of doc data from collection | |
function getCollectionData(collection) { |
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 functions = require("firebase-functions"); | |
const admin = require("firebase-admin"); | |
const got = require("got"); | |
const { | |
dnsLookupIpVersionToFamily, | |
} = require("got/dist/source/core/utils/dns-ip-version"); | |
const runtimeOpts = { | |
timeoutSeconds: 10, | |
memory: "256MB", |
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 script will execute a very fast copy command every 20mins and a slower sync (which will delete remote items) script every 2hrs | |
# All of the files live in your user directory in a 'cron' folder | |
# Logs are saved in verbose mode -v | |
# Deleted items are copied to another remote location. I suggest a different bucket upon which you can set a lifecyle, i.e. delete after 90 days. | |
## Mac Instructions | |
# open terminal.app | |
# cd ~/cron |
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 | |
# Cloudflare as Dynamic DNS | |
# From: https://letswp.io/cloudflare-as-dynamic-dns-raspberry-pi/ | |
# Based on: https://gist.github.com/benkulbertis/fff10759c2391b6618dd/ | |
# Original non-RPi article: https://phillymesh.net/2016/02/23/setting-up-dynamic-dns-for-your-registered-domain-through-cloudflare/ | |
# Update these with real values | |
auth_email="email@example.com" | |
auth_key="global_api_key_goes_here" | |
zone_name="example.com" |