Thanks for saying you like my camera set up! As you asked, here are the deets. There are cheaper ways to achieve some of the same results and possibly better ways to - however this is what I ended up with.
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
package main | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"runtime" |
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
{:profiles | |
{:oneshot {:default true | |
:alone 300 ; | |
:held 150 ; | |
:delay 500 ; time after which the key press is delayed | |
:sim 50}} ; keys need to be pressed within this threshold to be considered simultaneous | |
:main [{:des "Symbol Mode" | |
:rules [:symbol-mode | |
[:q :grave_accent_and_tilde] |
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 glob from 'fast-glob' | |
import { build } from 'esbuild' | |
import { Project } from 'ts-morph' | |
const project = new Project({ | |
compilerOptions: { | |
outDir: 'dist', | |
emitDeclarationOnly: true, | |
}, | |
tsConfigFilePath: './tsconfig.json', |
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 { Hookable } from '../src/hookable' | |
describe('hookable', () => { | |
test('hook with one callback', async () => { | |
const hooks = new Hookable<{ | |
invert:(value: boolean) => boolean | Promise<boolean> | |
}>() | |
hooks.hook('invert', value => !value) |
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
const { build } = require('estrella') | |
const { dependencies } = require('./package.json') | |
build({ | |
entry: 'src/index.ts', | |
outfile: 'dist/index.js', | |
bundle: true, | |
platform: 'node', | |
external: Object.keys(dependencies), | |
}) |
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
// My DB has multiple collections (tables), they can extend | |
// this since the only difference is the data an collection, | |
// they're passed in as generics | |
export interface Record<TData, TCollection> { | |
data: TData; | |
ref: { | |
collection: { | |
id: TCollection; | |
}; | |
id: string; |
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
function partition(inputArray, callback) { | |
const result = {}; | |
for (const [indexOfValue, value] of inputArray.entries()) { | |
const propertyKey = callback(value, indexOfValue); | |
if (propertyKey === null || propertyKey === '') { | |
continue; | |
} | |
if (!{}.hasOwnProperty.call(result, propertyKey)) { | |
result[propertyKey] = []; | |
} |
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 * as React from "react"; | |
import { useMousePosition } from "~/hooks/useMousePosition"; | |
/** Component to cover the area between the mouse cursor and the sub-menu, to allow moving cursor to lower parts of sub-menu without the sub-menu disappearing. */ | |
export function MouseSafeArea(props: { parentRef: React.RefObject<HTMLDivElement> }) { | |
const { x = 0, y = 0, height: h = 0, width: w = 0 } = props.parentRef.current?.getBoundingClientRect() || {}; | |
const [mouseX, mouseY] = useMousePosition(); | |
const positions = { x, y, h, w, mouseX, mouseY }; | |
return ( | |
<div |
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
// Handle outside and local measurements easily | |
function Singular({ ref, value }) { | |
const [width, setWidth] = useState(-1) | |
const [useMeasureRef, useMeasureEffect] = useMeasure() | |
useMeasureRef(ref) | |
useMeasureEffect( | |
([node]) => { | |
setWidth(node.offsetWidth) | |
}, | |
[value] |
NewerOlder