Skip to content

Instantly share code, notes, and snippets.

View enagy27's full-sized avatar

Eric Nagy enagy27

View GitHub Profile
@enagy27
enagy27 / intl-plural.ts
Created November 18, 2023 00:53
Before and after comparison of the intl plural helper versus standard ICU format
// before
intl.formatMessage(
{
id: 'TemplateSearchResults.templates',
defaultMessage:
'{templatesCount, plural, one {{templatesCount} template} other {{templatesCount} templates}}',
description: 'Number of templates in a section',
},
{
templatesCount: category.numberOfTemplates,
import { TSESTree } from "@typescript-eslint/typescript-estree"
import { Rule } from "eslint"
import { isNotNullish } from "@notionhq/shared/typeUtils"
function closest(
node: TSESTree.Node,
predicate: (node: TSESTree.Node) => boolean
) {
let current = node
@enagy27
enagy27 / tables.test.tsx
Last active February 14, 2024 22:35
React testing library table queries
import React from 'react';
import { render } from '@testing-library/react';
import { queryAllByTableHeader } from './tables';
describe('table testing utils', () => {
it('test', () => {
render(
<div role="region" aria-labelledby="caption-id">
<table>