Skip to content

Instantly share code, notes, and snippets.

View kneczaj's full-sized avatar

Kamil Neczaj kneczaj

View GitHub Profile
find . -name '*.pdf' -exec qpdf --decrypt --password='pass' --replace-input '{}' \;
@kneczaj
kneczaj / test.md
Created March 19, 2024 15:58
Nock

To debug:

export DEBUG=nock.* && yarn test

Wait for request with:

await waitFor(() => {
  expect(result.current.isSuccess).toBeTruthy();
});
@kneczaj
kneczaj / makeStyles.ts
Last active February 15, 2023 14:19
makeStyles
// 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/legalcode,
// and a summary here: http://creativecommons.org/publicdomain/zero/1.0/"
/**
* Keeps css classes mapping from multiple `css` statements of Stiches library
*/
export type ClassesMapping<TLabels extends string | number | symbol> = {
[classLabel in TLabels]: string;
@kneczaj
kneczaj / README
Created September 19, 2022 23:50
Taxation for joint-stock company
Below text is CC0 licensed https://creativecommons.org/publicdomain/zero/1.0/legalcode
Comparison of a B2B contract
with a person conducting registered entrepreneurial activity
to a B2B contract with a limited joint-stock company
Short description of both
1) registered entrepreneurial activity (in Polish: "rejestrowana jedno działalność jednoosobowa")
A person can register themselves as conducting entrepreneurial activity in a particular field. This means that in this field of activity e.g. programming they act as a company. They need to register their cost and income invoices and pay tax according to the chosen taxation method. The person acts as fully responsible for all the liabilities of their entrepreneurial activity what is called acting as an individual - in contrast to a legal entity of a "limited" company (in Polish: "spółka z ograniczoną odpowiedzialnością").
@kneczaj
kneczaj / routeState.tsx
Created April 18, 2022 15:59
Route State Holder for React
// 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/legalcode,
// and a summary here: http://creativecommons.org/publicdomain/zero/1.0/"
import { Component, ComponentClass, ReactNode } from 'react';
import { RouteComponentProps, withRouter } from 'react-router-dom';
export interface ChildrenProps<TData> {
set: (val: TData, url?: string) => void;
value: TData;
// 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/legalcode,
// and a summary here: http://creativecommons.org/publicdomain/zero/1.0/"
const replace = require('replace-in-file');
const path = require('path');
const options = {
//Single file
files: path.resolve(
@kneczaj
kneczaj / by.ts
Last active February 18, 2022 15:26
E2E Page object pattern with webdriverio in synch mode (v6)
// 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/legalcode,
// and a summary here: http://creativecommons.org/publicdomain/zero/1.0/"
export class By {
static content(content: string): string {
return `.//*[contains(text(), '${content}')]`;
}
static classAndContent(className: string, content: string): string {
@kneczaj
kneczaj / ad.tsx
Last active March 1, 2022 00:19
Example of GraphQL api with loading wrappers
// 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 {
Ad as AdModel,
Enum_Ad_State,
useAddToWatchlistMutation,
useRemoveFromWatchlistMutation,
useUpdateAdMutation
} from 'generated/graphql';
@kneczaj
kneczaj / add.sh
Created May 5, 2021 15:01
Yarn install/remove git integration
// 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/"
#!/usr/bin/env bash
# check for changes
UNCOMMITED_CHANGES=`git status --porcelain=v1 2>/dev/null | wc -l`
COMMIT_MESSAGE="[PackageAdd] $@"
if [ $UNCOMMITED_CHANGES -gt 0 ]; then
@kneczaj
kneczaj / README
Created April 19, 2021 10:09
typescript relative paths
1) To import relative to baseUrl set baseUrl in tsconfig.json e.g.:
{
"compilerOptions": {
"baseUrl": "src",
...
}
}
2) To import relative to paths set them additionally to baseUrl in tsconfig.json e.g.:
{
"compilerOptions": {