Return the Galnet news.
Base URL: https://cms.zaonce.net/en-GB/jsonapi/node/galnet_article
You can change the en-GB
in the URL to get Galnet in others languages (fr-FR
, pt-BR
...).
"use strict"; | |
/** | |
* Hypertext Transfer Protocol (HTTP) response status codes. | |
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes} | |
*/ | |
enum HttpStatusCode { | |
/** | |
* The server has received the request headers and the client should proceed to send the request body |
import { type RefObject, useEffect, useState } from 'react'; | |
export type IntersectionObserverOptions = IntersectionObserverInit & { | |
intersectOnce?: boolean; | |
skip?: boolean; | |
}; | |
const emptyOptions: IntersectionObserverInit = {}; | |
const useIntersectionObserver = ( |
Return the Galnet news.
Base URL: https://cms.zaonce.net/en-GB/jsonapi/node/galnet_article
You can change the en-GB
in the URL to get Galnet in others languages (fr-FR
, pt-BR
...).
# Configuration for Alacritty, the GPU enhanced terminal emulator. | |
# Any items in the `env` entry below will be added as | |
# environment variables. Some entries may override variables | |
# set by alacritty itself. | |
#env: | |
# TERM variable | |
# | |
# This value is used to set the `$TERM` environment variable for | |
# each instance of Alacritty. If it is not present, alacritty will |
const hasCoarsePointer = () => window.matchMedia("(pointer: coarse)").matches | |
const hasMobileWidth = (maxWidth = 639) => | |
window.matchMedia(`(max-width: ${maxWidth}px)`).matches | |
const hasMultipleTouchPoints = () => navigator.maxTouchPoints > 1 | |
const hasTouchEvents = () => "ontouchstart" in document.documentElement | |
export const isMobile = ({ maxWidth } = {}) => { | |
return ( | |
hasCoarsePointer() && | |
hasMultipleTouchPoints() && |
const getElementsByText = (text, parent) => { | |
if (!text) return [] | |
const xpath = `//*[text()='${text}']` | |
const xpathResult = document.evaluate( | |
xpath, | |
parent || document, | |
null, | |
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, | |
null | |
) |
import { useCallback, useState } from "react" | |
export default function useForceUpdate(): VoidFunction { | |
const [, setValue] = useState<number>(performance.now()) | |
return useCallback((): void => { | |
setValue(performance.now()) | |
}, []) | |
} |
import { useMemo } from 'react' | |
type GeoLocation = { | |
latitude: number | |
longitude: number | |
} | |
export const useDistance = (pointA?: GeoLocation, pointB?: GeoLocation) => | |
useMemo(() => { | |
const isValid = x => x != null && isFinite(x) |