Skip to content

Instantly share code, notes, and snippets.

View ospatil's full-sized avatar

Omkar Patil ospatil

View GitHub Profile
@ospatil
ospatil / package.json
Created July 21, 2023 02:25
Zod playground - Conditional object fields based on value of other field
{
"name": "zod",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"init": "tsc --init",
"start": "node --loader ts-node/esm index.ts"
},
@ospatil
ospatil / shortcuts.md
Last active February 13, 2024 12:46
Essential shortcuts
VS Code
Jump to file explorer cmd + shift + e
Open highlighted file in file explorer cmd + down-arrow
Go back to editor cmd + 1
Toggle between terminal and editor ctrl + backtick
Open global search view cmd + shift + f
Fold all cmd + k + 0
Unfold all cmd + k + j
Unfold current option + cmd + [
@ospatil
ospatil / prototypes.js
Created June 14, 2022 19:30 — forked from torgeir/prototypes.js
javascript's __proto__ and prototype explained
/**
* __proto__ and prototype
* - the __proto__ property the instance's 'parent' up the prototype chain
* - the prototype property refers what new instances of the type will have their __proto__ set to, i.e. what will be the new instance's 'parent' up the prototype chain
*/
/* Given */
function Object () {}
Object.prototype = {
__proto__: null
@ospatil
ospatil / doc-table.md
Created May 27, 2022 11:05 — forked from antfu/doc-table.md
Doc Table in Markdown

Example

Name

Description


@ospatil
ospatil / launch.json
Last active July 10, 2023 22:00
Latest TS+tools setup
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// To debug ts files without compiling
"version": "0.2.0",
"configurations": [
{
"name": "ts-node",
"type": "node",
@ospatil
ospatil / script.sh
Last active October 2, 2021 15:36 — forked from lopezjurip/script.sh
Github full code review
# Create empty branch. git switch --orphan <branch name> deletes ALL files from the working tree. We don't want that.
git checkout --orphan review
# or delete only the required files that you need to review. For example, for nats project only delete go source files.
# find . -type f -name '*.go' -not -name '*test.go' -not -path '*/vendor/*' -delete
git rm -rf .
git commit --allow-empty -m "Create empty branch"
git push --set-upstream origin review
# Create `project` branch from `main` current state.
git switch -c project
@ospatil
ospatil / poc.ts
Created March 31, 2021 14:33
TypeScript type LeanDocument for mongoose and nestjs
class Doc {
attrA: string;
attrB: string;
id: string;
_id: any;
_v: number;
func1 = () => {}
func2 = () => {}
}
@ospatil
ospatil / docker-k8s-minikube.md
Last active May 22, 2026 21:50
Handy reference working locally with docker, kubernetes and minikube

Docker misc

  • Running a docker image with port mapping - docker run --init -p 4444:4444 --rm <IMAGE_NAME>

    --init makes it respond to signals like ctrl+c

    -d will make it run in detached mode, so for stopping you'll have to do docker ps and use the container id.

Working with minikube and local images

@ospatil
ospatil / Vagrantfile for Fedora 31 and Python 3.8
Last active June 6, 2023 06:46
Vagrant configuration for Fedora 31 and Python 3.8
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@ospatil
ospatil / VS Code shortcuts
Last active April 6, 2020 02:05
Keyboard navigation shortcuts for VS Code
# VS Code keyboard shortcuts
## Jumping between editors, views and terminal
* Jump to file explorer - `Cmd + shift + E`
* Switch between open editor tabs - `Ctrl` + `tab` or `Ctrl` + `1` or `2` so on
* Jump to terminal - `Ctrl + ``
* Quick View Selection - `Ctrl + Q`
* Jump to global search view - `Cmd + shift + F`
* Jump to Debug view - `shift + Cmd + D`