Skip to content

Instantly share code, notes, and snippets.

View santuman's full-sized avatar
🏠
Working from home

Santosh Subedi santuman

🏠
Working from home
View GitHub Profile

GraphQL over RestFul Api

Setting up an endpoint becomes messier as we go along with creating endpoints for nested relationsship

For Example endpoint for getting users friends of friends company, position

Making too many HTTP request

We need to make many request to get friends of friends company, position like

const a = item => new Promise(resolve => setTimeout(() => resolve(item), 10))
const b = item => new Promise(resolve => setTimeout(() => resolve(item), 100))
const c = item => new Promise(resolve => setTimeout(() => resolve(item), 200))
// Parallel
const parallel = async () => {
const processes = [a(), b(), c()]
const [output1, output2, output3] = await Promise.all(processes)
return `parallel is done: ${output1} ${output2} ${output3}`

Common Docker Command

Spin up a alpine container

$ docker run -it --name nodejs-alpine --rm alpine:3.10

--name -> giving custom name

@santuman
santuman / .zshrc
Last active October 29, 2021 18:49
gcap() {
git add . && git commit -m "$*" && git push
}
# NEW.
gnew() {
gcap "📦 NEW: $@"
}
# IMPROVE.

Copy Remote file to local

$ scp username@remoteHost:/remote/dir/file.txt /local/dir/
@santuman
santuman / creating-node-cli.md
Last active November 5, 2021 15:08
Instructions to create a simple cli tool using nodejs & npm

Creating Nodejs cli

$ mkdir sample
$ cd sample
$ npm init
$ touch index.js
@santuman
santuman / Docker.md
Last active October 22, 2022 04:14
Understanding Docker

pexels-chanaka-906494

Understanding Docker

A platform for building, running and shipping applications.

Reasons to use docker

Everyone have stumble upon this case right I works on my machine but not yours? How is that Possible?

@santuman
santuman / append-text.md
Created November 10, 2021 18:22
Appending text to a file in linux

Appending text to a file in linux

$ echo NEW_USER=santosh >> .bashrc

Overriding all text inside a file

This command will override everything from .bashrc with newtextblahblah

@santuman
santuman / Change-latest-commit-msg.md
Created November 11, 2021 12:39
Change latest commit message

Steps to change latest commit message

$ git commit --amend -m "New message"
$ git push --force repository-name branch-name

example,

@santuman
santuman / NFT.md
Last active December 13, 2021 14:15

NFT (Non Fungible Tokens)

WHAT ARE NFTS ?

Thought definition.

A way to represent anything unique as a Blockchain-based asset. Powered by smart contracts by smart contracts on a Blockchain. NFT can really be anything digital (such as drawings, music, your brain downloaded and turned into an AI). NFTs are popular in representing digital arts. But digital arts is only one way to use NFTs. Really they can be used to represent ownership of any unique asset, like a deed for an item in the digital or physical realm.

Formal definition (Technical Definition).