Skip to content

Instantly share code, notes, and snippets.

View gabrielpetersson's full-sized avatar
Focusing

Gabriel Petersson gabrielpetersson

Focusing
View GitHub Profile
[["https://cdn.midjourney.com/bd317521-32d7-4fcf-acef-64726fa7be68/0_7.png"],
["https://cdn.midjourney.com/abdc20a8-dfdc-449b-8ce8-8cdd5901f4f4/0_1.png"],
["https://cdn.midjourney.com/b2721737-1c59-41e5-90dc-61abff68fe41/0_0.png"],
["https://cdn.midjourney.com/ef526e55-c8c5-420d-a8e1-5a1a34a5c694/0_2.png"]]
use skia_safe::{
gpu::gl::FramebufferInfo,
gpu::BackendRenderTarget,
gpu::DirectContext,
Color,
Paint,
PaintStyle,
Surface,
Rect,
Point,
type EnumInputProps =
| {
isMultiSelect: true;
options: EnumOption[];
selected: EnumOption[];
onChange: (value: string[]) => void;
}
| {
isMultiSelect: false;
options: EnumOption[];
export const fetchRetry = async (
fetch: () => Promise<Response>,
maxTries: number = 4
): Promise<Response | "error"> => {
for (let tries = 0; tries < maxTries; tries++) {
if (tries !== 0) {
await wait(Math.pow(2, tries + 1) * 1000);
}
try {
const response = await fetch();
import { FC, useState } from "react";
import styled from "styled-components";
import { useAppSelector } from "../../state";
import { selectActiveTab } from "../../state/selectors";
import { colors } from "../../styles";
import { assertNever } from "../../util";
import { ConnectedModulesPage } from "../modules/ModulesPage";
import styles from "./MainView.module.scss";
import { TablesPage } from "./TablesPage";
const rows: any = [];
for (let i = 0; i < 14; i++) {
const [key, ordinal] = await Promise.all([
extra.keyGenerator.nextKey(),
extra.ordinalGenerator.nextOrdinal(),
]);
rows.push({
key,
values: [{ kind: "string", value: ordinal }],
const getIsRangeAlreadyCorrect = () => {
const ranges = gridApi.getCellRanges();
if (ranges == null || ranges.length !== 1) {
return false;
}
const range = ranges[0]!;
if (range.columns.length !== 1) {
return false;
}
if (isSearchBarClosing) {
(async () => {
await wait(300);
if (gridApi == null) {
return;
}
const ranges = gridApi.getCellRanges();
if (ranges?.length !== 1) {
import { log } from "../logging";
import { usePrevious } from "./usePrevious";
// NOTE(gab): Put dependencies in an object & see which deps makes
// components rerender
export const useDependencyDebugger = (
dependencies: Record<string, unknown>
): void => {
const dependencyValues = Object.values(dependencies);
const dependencyNames = Object.keys(dependencies);
import Tippy from "@tippyjs/react/headless";
import { FC, ReactElement, ReactNode } from "react";
import styled from "styled-components";
import { Spacer } from "../../../components/Spacer";
import { Txt } from "../../../components/Txt";
import { colors } from "../../../styles";
import { ColumnDisplayType } from "../../../util/column-display-config";
const TooltipContainer = styled.div`
display: flex;