Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
/* eslint-disable import/no-unused-modules */ | |
/** | |
Usage: | |
// logs out the calls per frame, mean time, etc, under "myFunction" | |
const myFunction = instrumentPerFrame(function myFunction() {...}); | |
// pass the name as the first parameter to wrap around methods and give them a name. |
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
let mode: "idle" | "dragging" = "idle" | |
const dragHandler: InteractionHandler = { | |
onDragStart(gesture, app) { | |
if (intersection(gesture.elementsUnderCursor, app.selectedElements).size) { | |
mode = "dragging"; | |
} | |
}, | |
onPointerMove(gesture) { | |
// ignore pointer-moves when we haven't started dragging |
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 {ChakraProvider, useColorMode} from "@chakra-ui/react" | |
import {Html} from "next/document" | |
import React from "react" | |
type ColorMode = "light" | "dark" | |
export function ChakraThemedHtmlComponent(props: { | |
colorMode: ColorMode | |
children: React.ReactNode | |
}) { | |
return ( |
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
type PromiseSequencer<T> = { | |
/** | |
* Add a promise to the end of the queue. When this promise resolves, you | |
* may be notified via onLatest, assuming that no later promise has resolved | |
* in the meantime. | |
*/ | |
push(promise: Promise<T>): void; | |
/** | |
* Remove all promises from the queue. Any promises in the queue can still |
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
function useTaskQueue(params: { | |
shouldProcess: boolean | |
}): { | |
tasks: ReadonlyArray<Task> | |
isProcessing: boolean | |
addTask: (task: Task) => void | |
} { | |
const [queue, setQueue] = React.useState<{ | |
isProcessing: boolean | |
tasks: Array<Task> |
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 {InternalRoutes} from "types/routes" | |
import Link, {LinkProps} from "next/link" | |
export function InternalLink({ | |
routeName, | |
routeParams, | |
...linkProps | |
}: Omit<LinkProps, "href" | "as"> & | |
InternalRoutes & {children: React.ReactChild}) { |
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
#include "node-svm.h" | |
#include "training-worker.h" | |
#include "prediction-worker.h" | |
#include "probability-prediction-worker.h" | |
using v8::FunctionTemplate; | |
using v8::Object; | |
using v8::String; | |
using v8::Array; |
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 audioCtx = new window.AudioContext(); | |
const oscillator = audioCtx.createOscillator(); | |
oscillator.connect(audioCtx.destination); | |
oscillator.type = "sine"; | |
let numItems = 0 | |
oscillator.frequency.setValueAtTime( | |
1, | |
audioCtx.currentTime |
NewerOlder