Skip to content

Instantly share code, notes, and snippets.

View zbigg's full-sized avatar
🧗

Zbigniew Zagórski zbigg

🧗
View GitHub Profile

I finally found my desired setup for passwords & tokens on my local machine.

(guess what, this is partially caused by recent events around npm, i don't want to have any token in my .bash/.profile/.config files. Period)

I don't want them also .in

  • .aws/credentials
  • .config/hcloud/cli.toml
  • ~/.config/gcloud/ - this fortunately very short lived, but there is refresh token which is at valid next day (for several hours)
  • ... etc
@zbigg
zbigg / node-inject-this-package.sh
Created May 29, 2024 10:57
inject package to target node_modules without npm/yarn link limitations
#!/usr/bin/env bash
# manually "install" or inject current package into target project `node_modules`
#
# Usage
# # ensure package is ready for npm pack
# # example: npm build
# node-inject-this-package.sh ../some-other-project
# node-inject-this-package.sh -C modules/subpackage ../some-other-project
#
@zbigg
zbigg / carto-react-to-ts.md
Last active March 28, 2023 11:31
cart-react-ts.md

Carto-react to TS

~ 14MD

Milestones targets

  1. 2MD - Working TSC toolchain.
  2. 1MD - All c4r modules are compiled by TSC and thus an be easily renamed to "*.ts" and improved
  3. 7MD - All c4r modules have sources in TS
  4. 1MD - C4r developer can write tests in typescript
@zbigg
zbigg / useAsyncCancellable.ts
Last active March 9, 2023 14:45
useAsyncCancellableX
/**
* Use cancellable async effect.
*
* Effect callback is expected to be async and accept and _use_ provided abort signal.
*
* signal is trigerred, when effect is replaced with new instance (deps change)
* or component is unmounted.
*
* To cancel effect, just introduce change in deps that will effect in "empty" flow, like
* empty `userInput` in example below.
@zbigg
zbigg / CoreFlowWithUserInteraction.md
Created February 13, 2023 12:18
CoreFlowWithUserInteraction.md

‎‎​

@zbigg
zbigg / objectKeyWithBestScore.ts
Created February 13, 2023 10:53
objectKeyWithBestScore.ts
/**
* Given dictionary K -> V, find a key with best score.
*
* If no score fun returns defined value, it will return `undefined`.
*
* Complexity O(nKeys)
*
* @param object object to search
* @param scoreFun score function applied over (k,v)
* @returns key or undefined
type JsonAllTypes = null | string | number | boolean | object;
/// Tainted Input - type modifier, that decorates "proper" type with
/// all possible bad input types.
/// Purpose. When parsing input, it's common to write
///
/// const x: Type = JSON.parse(input);
///
@zbigg
zbigg / test.md
Created February 21, 2020 11:28
Test

FooBar

dist/gh_deploy/
dist/gh_deploy/decoder.bundle.js.map
dist/gh_deploy/releases.json
dist/gh_deploy/_config.yml
dist/gh_deploy/index.css.map
dist/gh_deploy/0ce79b6b2ddf393b809c7a2ae509941e.jpg
dist/gh_deploy/index.bundle.js.map
dist/gh_deploy/docs
dist/gh_deploy/docs/index.html
dist/gh_deploy/examples
@zbigg
zbigg / typescript-robust-options-and-params-interfaces.md
Last active October 25, 2023 12:26
Options/Params/Defaults pattern

Options/Params/Defaults pattern

Code

// public part
export interface MyApiOptions {
    /// Typedoc here
    foo?: string;