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
...).
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) |
import { MutableRefObject, useEffect, useRef, useState } from 'react' | |
export const useIntersection = ( | |
ref: MutableRefObject<Element | null>, | |
options?: IntersectionObserverInit | null, | |
once = false | |
): boolean => { | |
const [isIntersecting, setIsIntersecting] = useState(false) | |
const observerRef = useRef<IntersectionObserver | null>(null) | |
const optionsRef = useRef<typeof options>() |
For some tasks, create an alternate path that does only the minimal required work (e.g., for data fetches requiring maximum performance, create multiple DAOs — some enriched, some impoverished)
Enforce sequential completion of high-priority tasks, even if multiple threads are available (e.g., chain Ajax calls enabling optional interactions only after minimal page load, even if later calls do not physically depend on earlier returns)