Skip to content

Instantly share code, notes, and snippets.

View lyjacky11's full-sized avatar

Jacky Ly lyjacky11

View GitHub Profile
@lyjacky11
lyjacky11 / FetchDocsPagination.js
Last active November 17, 2022 23:29
Pagination with Firebase & Firestore DB
import { db } from "../firebase";
import {
getDocs,
query,
collection,
orderBy,
startAfter,
limit,
} from "firebase/firestore";
@lyjacky11
lyjacky11 / LoadingSpinner.js
Last active November 17, 2022 23:28
React Loading Spinner using Bootstrap
import { useEffect, useState } from "react";
import Spinner from "react-bootstrap/Spinner";
const delayMs = 350;
let setTimeoutInstance;
export default function LoadingSpinner({ isLoading, children }) {
const [isDelayed, setIsDelayed] = useState(false);
useEffect(() => {
@lyjacky11
lyjacky11 / update_root_hints.sh
Created August 20, 2022 19:26
Update root.hints file for Pi-Hole Unbound Service
#!/bin/bash
echo "[i] Backing up root.hints ..."
cd /var/lib/unbound
sudo cp root.hints $(date +%F).root.hints
if [ -s $(date +%F).root.hints ]
then
echo "[✓] Backup root.hints success!"
echo ""