Skip to content

Instantly share code, notes, and snippets.

View istarkov's full-sized avatar
💭
I need snow, now!

Ivan Starkov istarkov

💭
I need snow, now!
View GitHub Profile
@istarkov
istarkov / 00 README.md
Last active April 2, 2024 20:18
How to style React components

How to style React components

If you use sass and css-modules and want to restyle some base component without changing its code. (base component already use css-modules and exposes styles property)

I know two way how to do it.

  1. Using composes css-modules operator. Just extend classes you need, then in javascript code combine both styles as {...baseStyle, ...myStyleSimple}

How to setup atom with nuclide plugins.

You need to install next packages

  • hyperclick
  • nuclide-diagnostics-store
  • nuclide-diagnostics-ui
  • nuclide-flow

You need to add .flowconfig

@istarkov
istarkov / .zshrc
Last active October 6, 2023 05:41
.zshrc pass function
pass() {
local input
read -r input
print -n "\e[1A\e[K"
local var=$(echo $input | sed 'y/[!"№%:,.;йцукенгшщзхъёфывапролджэячсмитьбюЙЦУКЕНГШЩЗХЪЁФЫВАПРОЛДЖЭЯЧСМИТЬБЮ/~!@#$%^&*qwertyuiop[]\\asdfghjkl;\''zxcvbnm,.QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>/')
echo -n "$var"
read -r input
print -n "\e[1A\e[K"
}
@istarkov
istarkov / serialize.js
Last active August 8, 2023 20:59
Serialize promise calls (run promises sequentially)
// promise
const sleep = (timeout, v) => new Promise(r => setTimeout(() => r(v), timeout));
// series to call
const series = [() => sleep(1000, 1), () => sleep(1000, 2), () => sleep(1000, 3)];
// serialize
const r = series
.reduce(
(m, p) => m.then(v => Promise.all([...v, p()])),
Promise.resolve([])
// Intent to test n8n endpoints locally
resource "random_id" "playground_tunnel_secret" {
byte_length = 35
}
resource "cloudflare_tunnel" "playground" {
provider = cloudflare.main
account_id = local.cloudflare_account_id
@istarkov
istarkov / services.md
Created May 5, 2023 05:57
Services I would probably use someday
@istarkov
istarkov / .zshrc
Created April 25, 2023 06:49
Get bw password by exact name, fix of this https://github.com/bitwarden/clients/issues/3366
# https://github.com/bitwarden/clients/issues/3366
# Usage:
# bwget <item-name>
# to get any org password
# bwget <item-name> null
# to get self password
bwget() {
local pwd
local count
# by default search inside any organisation
@istarkov
istarkov / .zshrc
Last active April 17, 2023 06:06
gitclean alias
# gitclean allows to work with multiple origins, cleans all deleteded aliases
alias gitclean="(git remote | xargs git remote prune) && git branch -vv | egrep '('\$(git remote | xargs | sed -e 's/ /|/g')')/.*: gone]' | awk '{print \$1}' | xargs git branch -D"
@istarkov
istarkov / icu.ts
Created November 4, 2021 11:41
icu.pegjs
/*Parses ICU messages format https://messageformat.github.io/messageformat/guide/
like
{from} - {to} {results, plural,
one { # result }
many { # results }
} text {vr} rmm
{s, select,
man { He is "#"#"#" }
woman { She is # }
}
@istarkov
istarkov / .bashrc
Last active June 9, 2022 22:28
Bash alias for terraform, switches all subfolder workspaces loads secrets sets NOMAD and CONSUL envs
# ------------------------------------------------------------------------------
# `hashi` - shows all subfolders workspaces
# `hashi test` - switch all subfolders terraform workspaces to test, load test secrets and sets nomad and consul env vars
# `hashi -init-all` - execute terraform init at all subfolders terraform workspaces
# `hashi <tab>` - autocomplete workspaces
# `hashi .<tab>` - autocomlete and cd into
# `hashi -<tab>` - autocomlete commands
alias gitclean="git remote prune origin && git branch -vv | grep 'origin/.*: gone]' | awk '{print \$1}' | xargs git branch -D"