This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| keyboard "Meta" | |
| key Space+Ctrl : "\x00" | |
| key F7+AnyModifier : "\E[18;*~" | |
| key F7-AnyModifier : "\E[18~" | |
| key F8+AnyModifier : "\E[19;*~" | |
| key F8-AnyModifier : "\E[19~" | |
| key F5+AnyModifier : "\E[15;*~" | |
| key F5-AnyModifier : "\E[15~" | |
| key F6+AnyModifier : "\E[17;*~" | |
| key F6-AnyModifier : "\E[17~" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| (global as any).window = Object.create(window); | |
| const url = "http://dummy.com/dummy"; | |
| Object.defineProperty(window, 'location', { | |
| value: { | |
| href: url | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| import React from "react"; | |
| import { getInitialState, User } from "../models/user"; | |
| import { isNull } from "../../util"; | |
| import { createContext, createContextHook } from "../../utils/context-hook"; | |
| import { ProviderComponentProps } from "../../components/provider-group"; | |
| import { useState } from "../../hooks/state"; | |
| import { useHistory } from "../../routing/hooks/history"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| import React from "react"; | |
| import { render } from "@testing-library/react"; | |
| import { InnerComponent } from './hooks-collection-sandbox/innner-component'; | |
| import { useTest } from "./hooks-collection-sandbox/mocks"; | |
| import * as HooksCollection from "./hooks-collection-sandbox/mocks"; | |
| import { ContextError } from "../utils/context-hook"; | |
| import { mockHookCollection } from "./hooks-collection"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| export const mockContextHook = <THookFn extends (...args: any[]) => any, Method extends string, Obj extends { [key in Method]: THookFn}>(obj: Obj, method: Method, defaultValue: ReturnType<THookFn>) => | |
| (val?: ReturnType<THookFn>) => { | |
| jest.spyOn(obj, method).mockImplementation((...args: Parameters<THookFn>) => val || defaultValue) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| import React, { Context as ReactContext, useContext } from "react"; | |
| import { isUndefined } from "../util"; | |
| /** | |
| * Differs from react context by mandatory displayName | |
| */ | |
| export interface Context<T> extends ReactContext<T> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # moves .gitignore from root directory to /frontend, . is escaped by \ | |
| git filter-branch -f --index-filter 'git ls-files -s | sed "s/\.gitignore/frontend\/\.gitignore/" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| import { FieldRenderProps, useField as useFieldBase, UseFieldConfig as UseFieldConfigBase } from "react-final-form"; | |
| import { isUndefined } from "../../util"; | |
| import { useMemo } from "react"; | |
| export interface UseFieldConfig<FieldValue> extends Omit<UseFieldConfigBase<FieldValue>, 'formatOnBlur'> { | |
| formatOnBlur?: UseFieldConfigBase<FieldValue>['format']; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // To the extent possible under law, Kamil Neczaj has waived all copyright and related or neighboring rights to this code, | |
| // which is published here under license CC0, full text of the license here: http://creativecommons.org/publicdomain/zero/1.0/" | |
| /** | |
| * false if no error, otherwise true or a dict with error details | |
| */ | |
| export type ValidationError = [ string, { [key: string]: any }] | string; | |
| export type ValidationResult = ValidationError | null; | |
| /** | |
| * A validator function which returns an error in a dict format which then can be used to generate a translated error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find: | |
| validators\=\{(.*)} | |
| in the first parentheses there is the captured text | |
| replace | |
| validate\=\{composeValidators\($1\)} | |
| then the captured text lands in $1 |