Skip to content

Instantly share code, notes, and snippets.

View saostad's full-sized avatar
🤠

saostad

🤠
View GitHub Profile
@saostad
saostad / git-commit-prefixes.md
Last active March 16, 2021 00:30
git commit prefixes

it's recommended to have separate commit for each change

order in commit messages when multi line needed:

  • pub: x.x.x /** publish in package repository version: semver majon.minor.bugfix == breaking.feat.fix */
  • breaking: /** explanation of breaking change */
  • feat: /** added a feature */
  • fix: /** bug fix */
  • enhance: /** improve existing functionality (mostly performance) */
  • depricate: /** deprication of existing functionality */

generated typescript type definitions and functions to interact with ProjectSight api

Steps:

  • get ProjectSight api swagger spec and save it as file project-sight-api-spec.json
  • download latest version of swagger-codegen
  • generate type def and functions with swagger-codegen (it's a Java command line tool)
    • Oracle JRE needed to run command
  • command to generate the types java -jar swagger-codegen-cli.jar generate -l typescript-node -o ./api/ -i ./project-sight-api-spec.json --config typescript-node.json
@saostad
saostad / typescript-typescript-type-required-fields-based-on-other-fields.ts
Created July 7, 2021 21:21
typescript type required fields based on other fields
type a = {
c: "Hello";
/** ggg */
d: boolean;
e?: never;
} | {
c: "World";
d?: never;
/** hhh */
e: string;
@saostad
saostad / decode-base64-columns.sql
Last active August 18, 2021 13:30
How to decode base64 columns inline with T-SQL query
SELECT convert(varchar(max),cast(N'' as xml).value('xs:base64Binary(sql:column("MBAMPolicy.EncodedComputerName0"))', 'VARBINARY(MAX)')) AS [Computer Name]