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
/** | |
* @file A compact utility for securely storing user passwords | |
* that are hashed using sha512 and a salt. | |
* @author David Alexander Pfeiffer <david.pfeiffer971@gmail.com> | |
*/ | |
import crypto from "crypto"; | |
/** | |
* Hash password with sha512, generates and appends a new random salt. | |
* @function |
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
# config.yml in traefik directory | |
# Dynamic Configuration for Dashboard | |
http: | |
routers: | |
dashboard: | |
# Your domain here | |
rule: Host(`traefik-dashboard.example.com`) | |
service: api@internal | |
middlewares: | |
- 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
// file: App.js | |
// example usage | |
import { AuthContext } from './context/AuthContext'; | |
import { useLocalStorage } from './hooks/useLocalStorage'; | |
import SomeComponent from './components/SomeComponent'; | |
export const App = () => { | |
const [storedValue, setValue] = useLocalStorage("authToken", null); |
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
import { useEffect, useRef, useState } from "react"; | |
const useMediaQuery = (minWidth, maxWidth) => { | |
const mediaQuery = "screen".concat( | |
minWidth !== undefined ? ` and (min-width: ${minWidth})` : "", | |
maxWidth !== undefined ? ` and (max-width: ${maxWidth})` : "" | |
); | |
const [matches, setMatches] = useState(window.matchMedia(mediaQuery).matches); |