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 React, { useState, useEffect } from "react"; | |
/* | |
* Check whether a page is visible to a user. | |
* Return true if it is visible to the user. Return false otherwise. | |
*/ | |
function usePageVisibility() { | |
const [isVisible, setIsVisible] = useState(getIsDocumentHidden()); | |
const onVisibilityChange = () => setIsVisible(getIsDocumentHidden()); |
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
def slugify(words): | |
# https://gist.github.com/hagemann/382adfc57adbd5af078dc93feef01fe1 | |
# NOTE: This is inspired by @hagemann's awesome Javascript function for making a URL slug. | |
a = 'àáâäæãåāăąçćčđďèéêëēėęěğǵḧîïíīįìłḿñńǹňôöòóœøōõőṕŕřßśšşșťțûüùúūǘůűųẃẍÿýžźż·/_,:;' | |
b = 'aaaaaaaaaacccddeeeeeeeegghiiiiiilmnnnnoooooooooprrsssssttuuuuuuuuuwxyyzzz------' | |
p = "|".join(list(a)) | |
regex = re.compile(p) | |
slugified_words = words.lower() |