Use this regular expression to match BEM class-names:
^\.[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$
package main | |
import ( | |
"fmt" | |
"os" | |
"runtime" | |
"testing" | |
) | |
func TestMain(m *testing.M) { |
import { Client, ServiceError, Metadata, CallOptions, ClientUnaryCall } from '@grpc/grpc-js'; | |
import { Message } from 'google-protobuf'; | |
type OriginalCall<T, U> = (request: T, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError, res: U) => void) => ClientUnaryCall; | |
type PromisifiedCall<T, U> = ((request: T, metadata?: Metadata, options?: Partial<CallOptions>) => Promise<U>); | |
export type Promisified<C> = { $: C; } & { | |
[prop in Exclude<keyof C, keyof Client>]: (C[prop] extends OriginalCall<infer T, infer U> ? PromisifiedCall<T, U> : never); | |
} |
import debounce from 'lodash/debounce' | |
import { RefObject, useEffect } from 'react' | |
export const useWidthObserver = <T extends HTMLElement>( | |
refObject: RefObject<T>, | |
setWidth: (width: number) => void | |
) => { | |
useEffect(() => { | |
function resizeListener() { | |
if (refObject.current) { |
import Dashboard from 'pages/Dashboard' | |
import Layout from 'components/Layout' | |
import Login from 'pages/Login' | |
import React from 'react' | |
import { useRoutes, Navigate, useLocation } from 'react-router-dom' | |
import { useAuth, userContext } from 'hooks/useAuth' | |
function App() { | |
const storedToken = localStorage.getItem('token') | |
const location = useLocation() |
import { | |
ApolloClient, | |
ApolloLink, | |
HttpLink, | |
InMemoryCache, | |
} from '@apollo/client' | |
import { getMainDefinition } from '@apollo/client/utilities' | |
import { setContext } from '@apollo/link-context' | |
import { onError } from '@apollo/link-error' | |
import { RetryLink } from '@apollo/link-retry' |
import * as firebase from 'firebase/app' | |
import { useEffect, useState, createContext } from 'react' | |
export type AuthState = { | |
initializing: boolean | |
user: firebase.User | null | |
} | |
export const userContext = createContext<AuthState>({ | |
initializing: true, |
#include<iostream> | |
int main() { | |
char c; | |
// Set the terminal to raw mode | |
while(1) { | |
system("stty raw"); | |
c = getchar(); | |
// terminate when "." is pressed | |
system("stty cooked"); |
import { isSameMonth, startOfMonth } from 'date-fns' | |
export const generateCalendar = ( | |
firstDateOfMonth: Date | |
): number[][] => { | |
const date = startOfMonth(firstDateOfMonth) | |
const getDay = (date: Date) => { | |
let day = date.getDay() | |
if (day === 0) day = 7 |
const findBestPlacement = (count) => { | |
const result = [4, 5, 6, 7].map(rows => ({ | |
'Rows': rows, | |
'Columns': ((count / rows) ^ 0) === (count / rows) ? count / rows : (count / rows >> 0) + 1, | |
'Excess': count % rows, | |
'Free': count % rows === 0 ? 0 : rows - count % rows | |
})); | |
return [...result] | |
.filter((item) => { |