Skip to content

Instantly share code, notes, and snippets.

View OleksandrKucherenko's full-sized avatar

Oleksandr OleksandrKucherenko

View GitHub Profile
@OleksandrKucherenko
OleksandrKucherenko / settings.json
Created April 18, 2024 09:47
VsCode ToDo Tree Configuration for Unit Tests highlighting
{
// ... trimmed ...
"todo-tree.general.tags": [
"BUG",
"HACK",
"FIXME",
"TODO",
"XXX",
"[ ]",
"[x]",
@OleksandrKucherenko
OleksandrKucherenko / _commons.sh
Created September 12, 2023 12:49
Parse BASH script input arguments in a simplest way
#!/usr/bin/env bash
# shellcheck disable=SC2155,SC2034,SC2059
# get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# is allowed to use macOS extensions (script can be executed in *nix environment)
use_macos_extensions=false
if [[ "$OSTYPE" == "darwin"* ]]; then use_macos_extensions=true; fi
@OleksandrKucherenko
OleksandrKucherenko / directory-autocomplete-prompts.ts
Created June 2, 2023 06:57
Prompts NPM, ask for current working directory with autocomplete/autosuggestions with use of globs
import { glob } from 'glob'
import fs from 'node:fs'
const cwd = {
message: `Current working directory (ex. ~/project, ../project, ./project):`,
type: `autocomplete`,
limit: 10,
choices: [
/* force prompts to render 10 lines */
{ title: `Current working directory`, value: process.cwd() },
@OleksandrKucherenko
OleksandrKucherenko / data-driven-framework.md
Created October 21, 2022 12:04
The template of Experiment definition for Data Driven approaches. ref: https://medium.com/@olku/my-data-driven-approach-framework-900e8ac710cd

Framework

Step Questions
Change Request Why? What? How?
Confirmation Metrics, Success/Failure criteria;
Execution Given/When/Then? How Long? How Many? What is Required? Inputs/Outputs/Trends?
Decisions and Artifacts Automated metric grabber (per hour, per day); Side effects

Example

// Here's a sample binary tree node class:
open class BinaryTreeNode constructor(var value: Int) {
var left: BinaryTreeNode = Empty
protected set
var right: BinaryTreeNode = Empty
protected set
fun insertLeft(leftValue: Int): BinaryTreeNode {
check(leftValue >= 0) { "Expected only positive values" }
this.left = BinaryTreeNode(leftValue)
@OleksandrKucherenko
OleksandrKucherenko / javascript-review-checklist.md
Last active September 22, 2022 09:47 — forked from bigsergey/review-checklist.md
Front-end JavaScript/TypeScript Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
@OleksandrKucherenko
OleksandrKucherenko / Dockerfile
Created August 30, 2022 10:31
Dockerfile that compiles/build React App and deploy it to the NGINX server
## build production version
# https://hub.docker.com/_/node
# FROM node:16 as build-dev
# FROM node:16-alpine as build-dev
FROM cypress/base:16 as build-dev
WORKDIR /app
# copy project source code into docker container folder
# .dockerignore configures what to skip during the execution
@OleksandrKucherenko
OleksandrKucherenko / qa_run_docker.sh
Created August 30, 2022 10:25
MACOSX Script that executes React App on local docker for testing.
#!/usr/bin/env bash
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
container_name=${CI_CONTAINER_NAME:="hvc-csp"}
container_port=${CI_CONTAINER_PORT:=8081}
# include other scripts
# shellcheck disable=SC1090 source=./dependencies.sh
source "$SCRIPT_DIR/dependencies.sh"
@OleksandrKucherenko
OleksandrKucherenko / qa_validate_nginx_config.sh
Created August 30, 2022 09:59
MACOSX Script to Verify NGINX server configuration on local computer before deployment. Lines 62-63 expects special location of the NGINX configuration files.
#!/usr/bin/env bash
# shellcheck disable=SC2086
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# include other scripts
# shellcheck disable=SC1090 source=dependencies.sh
source "$SCRIPT_DIR/dependencies.sh"
# shellcheck disable=SC1090 source=commons.sh
source "$SCRIPT_DIR/commons.sh"
@OleksandrKucherenko
OleksandrKucherenko / commons.sh
Created August 30, 2022 09:56
MACOSX helper functions for writing user friendly scripts. Contains: logger, execution time tracking, user input validation, inject of secrets, flags as script arguments detection;
#!/usr/bin/env bash
# shellcheck disable=SC2155,SC2034,SC2059
# get script directory
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# is allowed to use macOS extensions (script can be executed in *nix environment)
use_macos_extensions=false
if [[ "$OSTYPE" == "darwin"* ]]; then use_macos_extensions=true; fi