Skip to content

Instantly share code, notes, and snippets.

View click2install's full-sized avatar
:octocat:
Clicking, double clicking, sending email, receiving email ... I could go on.

click2install click2install

:octocat:
Clicking, double clicking, sending email, receiving email ... I could go on.
View GitHub Profile
@click2install
click2install / useResizeObserver.ts
Last active August 28, 2021 11:30
[useResizeObserver] - A React hook for observing any element resize.
import { RefObject, useEffect, useState } from "react";
import ResizeObserver from "resize-observer-polyfill";
type BoundingRect = Omit<DOMRectReadOnly, "toJSON">;
export function useResizeObserver<T extends HTMLElement>(target: RefObject<T>)
{
const [state, setState] = useState<BoundingRect>({ bottom: 0, height: 0, left: 0, right: 0, top: 0, width: 0, x: 0, y: 0 });
@click2install
click2install / DateTime.ts
Created November 21, 2021 08:07
[DateTime] - A GraphQL ScalarType for Luxon DateTime
import type { GraphQLScalarTypeConfig } from "graphql";
import { GraphQLScalarType } from "graphql";
import { DateTimeResolver } from "graphql-scalars";
import { DateTime } from "luxon";
export const GraphQLDateTimeConfig: GraphQLScalarTypeConfig<DateTime, DateTime> =
{
name: "DateTime",
description: "An ISO8601 date-time string represented by a Luxon DateTime instance.",