Every block
should be in separated file named as block.
Filename: rating-star.scss
.rating-star {
$font-size: 0.5em;
display: inline-block; // `display` style may be set freely
import { useState, useLayoutEffect } from 'react' | |
type FullScreenState = boolean | |
type ToggleFullScreen = () => void | |
function useFullScreen<E extends HTMLElement>(ref: React.RefObject<E>): [FullScreenState, ToggleFullScreen] { | |
const [isFullScreen, setFullScreen] = useState( | |
Boolean(document.fullscreenElement), | |
) |
import * as React from 'react'; | |
export const getNodeArray = <Props = any>( | |
components: React.ReactNode, | |
filter?: string | React.ComponentClass<any> | React.SFC<any>, | |
) => { | |
let result = React.Children.toArray(components).map(React.Children.only) as React.ReactElement<Props>[]; | |
if (filter) { | |
result = result.filter((c) => { |
#!/usr/bin/env node | |
// TODO(vojta): pre-commit hook for validating messages | |
// TODO(vojta): report errors, currently Q silence everything which really sucks | |
'use strict'; | |
var child = require('child_process'); | |
var fs = require('fs'); | |
var util = require('util'); |
export type Route = { | |
method: "*" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE" | |
path: string | |
regexp: RegExp | |
handler: (request: Request, route: MatchedRoute) => Promise<Response> | |
} | |
export type MatchedRoute = Route & { | |
url: URL | |
} |
Example:
zsh-5.7.1-1-x86_64.pkg.tar.xz
// branded types to allow for better type inference | |
// with default generic types | |
/* eslint-disable @typescript-eslint/naming-convention */ | |
type NO_PAYLOAD = { | |
JgJES6BF8uyaOwF1: "FY7eBhPYJlqOxuVp"; | |
}; | |
type OPTIONAL_PAYLOAD = { | |
A7nWdXs0r5RLuHRf: "zPcrRNRIl4r5IHbA"; | |
}; |
function isPlainObject(item: unknown): item is Record<string, unknown> { | |
return item && (item as object).constructor === Object | |
} | |
function filterProto([key, value]: [string, unknown]) { | |
// Avoid prototype pollution | |
return key !== '__proto__' | |
} | |
const deepmerge = ( |
import glob from 'fast-glob' | |
import nodeURL from 'url' | |
import process from 'process' | |
/** Returns pathnames matching the given pattern. */ | |
const sync = (source: string) => glob.sync(source, options()) as string[] | |
/** Returns pathnames matching the given pattern. */ | |
const async = (source: string) => glob(source, options()) as Promise<string[]> |
// Adapted from https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_transpiler_loader | |
import { readFileSync, writeFileSync } from 'fs' | |
import { dirname } from 'path' | |
import { URL, pathToFileURL, fileURLToPath } from 'url' | |
import esbuild from 'esbuild' | |
const baseURL = pathToFileURL(`${process.cwd()}/`).href | |
const tsExtensionRegex = /\.(tsx?)$/ | |
function readJSON(path) { |