Skip to content

Instantly share code, notes, and snippets.

View hekystyle's full-sized avatar

Tomas Heky Hekrla hekystyle

View GitHub Profile
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.4",
"info": {
"title": "Internal API",
"description": "Internal API",
"version": "1.0-0.0.0"
},
"paths": {
"/api/v1/accounting-companies": {
"post": {
@hekystyle
hekystyle / gist:97b21ee2700a05aded1a3427dcef6333
Created October 9, 2025 12:46
Recursively remove all bin and obj folder, usefull for .NET projects when there are weirdos errors while compiling.
Get-ChildItem -Path "./" -Directory -Recurse -ErrorAction SilentlyContinue | Where-Object { $_.Name -ieq "bin" -or $_.Name -ieq "obj" } | Remove-Item -Recurse -Force
@hekystyle
hekystyle / find-fastest-horses.ts
Last active November 12, 2023 18:46
Solution of parallel search for fastest horse from Google interview.
export interface Speedy {
speed: number;
}
export class FastestItemsFinder {
constructor(
private readonly config = {
workersCount: 5,
fastestCount: 3,
},
@hekystyle
hekystyle / transform.ts
Last active October 1, 2025 13:41
Mute all TS errors by @ts-expect-error comment
// generate output using this command: `./node_modules/.bin/tsc --noEmit > ts-errors.txt`
// then apply directive using command: `jscodeshift --v --extensions="ts,tsx" -t ./transform.ts ./src`
import type { Transform } from 'jscodeshift';
import { readFileSync } from 'node:fs';
import path, { normalize } from 'node:path';
import { cwd } from 'node:process';
import R from 'ramda';
function applyIgnoreDirective(line: string, errorIndices: number[]): string[] {
const leadingWhitespaceMatch = line.match(/^(\s*)/);
@hekystyle
hekystyle / bread.ts
Last active April 1, 2023 19:14
OOP Bread + Cutter
class Bread {
constructor(public readonly width: number) {
if (width <= 0) {
throw new Error('width must be positive')
}
}
}
class BreadCutter {
cut(bread: Bread, width: number): Bread[] {
@hekystyle
hekystyle / usePropsComparison.ts
Last active April 1, 2023 19:02
usePropsComparison
export function usePrevious<T>(value: T): T | undefined {
const ref = useRef<T>();
useEffect(() => {
ref.current = value;
});
return ref.current;
}
@hekystyle
hekystyle / Select.tsx
Last active January 6, 2022 10:10
Extends Select from Ant design by suffix using styled components
import React, { VFC } from 'react';
import styled, { css } from 'styled-components';
import { Select as AntdSelect, SelectProps as AntdSelectProps } from 'antd';
import { SelectValue } from 'antd/lib/select';
export interface SelectProps extends AntdSelectProps<SelectValue> {
suffix?: React.ReactElement;
}
const StyledSelect = styled(AntdSelect)<SelectProps>`