https://dev.to/okmttdhr/tips-for-contributing-to-typescript-4edi
This file contains 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
const root = 0; | |
const parentIndex = i => Math.floor((i - 1) / 2); | |
const leftIndex = i => 2 * i + 1; | |
const rightIndex = i => leftIndex(i) + 1; | |
// With Bitwise Operations; | |
// const parentIndex = i => ((i + 1) >>> 1) - 1; | |
// const leftIndex = i => (i << 1) + 1; | |
// const rightIndex = i => (i + 1) << 1; |
This file contains 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
// https://github.com/okmttdhr/libuv/blob/8ea8f124386486af2380127c6885848f9d502a36/src/unix/epoll.c#L208-L420 | |
for (;;) { | |
/* Only need to set the provider_entry_time if timeout != 0. The function | |
* will return early if the loop isn't configured with UV_METRICS_IDLE_TIME. | |
*/ | |
if (timeout != 0) | |
uv__metrics_set_provider_entry_time(loop); | |
/* See the comment for max_safe_timeout for an explanation of why | |
* this is necessary. Executive summary: kernel bug workaround. |
This file contains 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 from "react"; | |
import { MessengerClient } from "./messenger/MessengerServiceClientPb"; | |
interface GRPCClientContextValue { | |
messengerClient?: MessengerClient; | |
} | |
const defaultContextValue = { | |
messengerClient: new MessengerClient(`http://localhost:8080`) | |
}; |
This file contains 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
data Tree a = Empty | Node !a !(Tree a) !(Tree a) | |
makeTree :: [a] -> Tree a | |
makeTree xs = fst $ makeTree' (length xs) xs | |
makeTree' :: Int -> [a] -> (Tree a, [a]) | |
makeTree' 0 xs = (Empty, xs) | |
makeTree' n (x:xs) = (Node x l r, zs) | |
where | |
m = n `div` 2 | |
(l, ys) = makeTree' m xs |
This file contains 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
export const retry = (fn: () => Promise<any>, timeout = 1000, retries = 5) => | |
new Promise((resolve, reject) => { | |
fn() | |
.then(resolve) | |
.catch(() => { | |
setTimeout(() => { | |
const retriesLeft = retries - 1; | |
if (retries < 0) { | |
return reject('maximum retries exceeded'); | |
} |
- W3C Geolocation API - Wikipedia
- The most common sources of location information are IP address, Wi-Fi and Bluetooth MAC address, radio-frequency identification (RFID), Wi-Fi connection location, or device Global Positioning System (GPS) and GSM/CDMA cell IDs.
- Location information server - Wikipedia
- Global Positioning System - Wikipedia
- The GPS concept is based on time and the known position of GPS specialized satellites.
- The satellites carry very stable atomic clocks that are synchronized with one another and with the ground clocks.
- Each GPS satellite continuously transmits a radio signal containing the current time and data about its position.
- GPS navigation device - Wikipedia
- A GPS navigation device, GPS receiver, or simply GPS is a de
- 時刻系(じこくけい)とは時間が経過する歩度、もしくは時刻、またはその両方の基準である。
- UTCやGMTなども厳密には定義が異なる。
- その中でも国際原子時(TAI)はUTCを含む他の時刻基準の計算の基となる基礎的な国際時刻基準である。
- TAIは国際度量衡局(BIPM)によって維持されており、環境的・相対論的効果を補正された世界中の数多くの原子時計の入力を合成して作られている。
https://github.com/nuxt/nuxt.js/blob/master/lib/builder/builder.js#L198
{
// ...
build: {
extend (config, { isDev, isClient }) {
NewerOlder