Skip to content

Instantly share code, notes, and snippets.

View valtism's full-sized avatar
🇦🇺

Dan Wood valtism

🇦🇺
View GitHub Profile
import React, { useMemo } from "react";
import { GetLineSegmentsConfig } from "../util/getSplitLineSegments";
import { line } from "../util/D3ShapeFactories";
import { LinePathConfig } from "../types";
export type SplitLinePathRenderer = (renderProps: {
index: number;
segment: { x: number; y: number }[];
styles?: Omit<React.SVGProps<SVGPathElement>, "x" | "y" | "children">;
}) => React.ReactNode;
import type { LinePathConfig } from "@visx/shape";
import { line } from "@visx/shape";
import clsx from "clsx";
import { getClosest } from "migrated/shared/helpers/getClosest";
import * as React from "react";
type PrySplitLinePathRenderer = (renderProps: {
index: number;
path: string;
styles: Omit<React.SVGProps<SVGPathElement>, "x" | "y" | "children">;
@valtism
valtism / App.tsx
Created July 14, 2023 00:39
Uniq Benchmark
import { useState } from "react";
import { uniq } from "lodash";
import "./App.css";
function uniqSet(arr: unknown[]) {
return Array.from(new Set(arr));
}
function getRandomInt(min: number, max: number) {
min = Math.ceil(min);
@valtism
valtism / PerformantSplitLinePath.tsx
Created April 8, 2024 03:48
A more performant version of Visx's `<SplitLinePath>`. See https://github.com/airbnb/visx/issues/1591
import { LinePath, line } from "@visx/shape";
import { SplitLinePathProps } from "@visx/shape/lib/shapes/SplitLinePath";
import { Fragment } from "react";
type PerformantSplitLinePathRenderer = (renderProps: {
index: number;
path: string;
styles?: Omit<React.SVGProps<SVGPathElement>, "x" | "y" | "children">;
}) => React.ReactNode;
@valtism
valtism / v0.2.1.json
Created June 8, 2026 19:30
Zed theme schema updated
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://zed.dev/schema/themes/v0.2.1.json",
"title": "ThemeFamilyContent",
"description": "The content of a serialized theme family.",
"type": "object",
"required": ["author", "name", "themes"],
"properties": {
"author": {
"type": "string"