Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
to the moon

Soumik Pradhan griimick

🚀
to the moon
View GitHub Profile
View .vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'sheerun/vim-polyglot'
Plugin 'morhetz/gruvbox'
View 0-breaking-down-promises.md

Breaking down Promises

History (Callbacks)

Promises were created to write async code better which was previously written using callbacks. Callbacks were not very readable and hence not scalable.

Snippets:

An asynchronous function without callback. The problem here is we cannot capture the value of the a + b when it executes after ~200ms.

@griimick
griimick / .vimrc
Created Apr 29, 2021
VIM Vite Typescipt
View .vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'sheerun/vim-polyglot'
Plugin 'morhetz/gruvbox'
@griimick
griimick / debounce.js
Last active Apr 13, 2021
Debounce & Throttle
View debounce.js
/*
* Call dembounced function only after `limit` amount of time
* has passed since the last call. The limit resets if the function is called
* before before `limit` amount of duraction has passed from the last call.
* This impliesa delay between the last event and handle function call.
*/
export default customDebounce (func, limit) {
let timeout;
return debouncedFunction () {
let context = this, args = arguments;
@griimick
griimick / command
Created Feb 10, 2021
Recursively download pkg and its deps
View command
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances vim | grep "^\w" | sort -u)
@griimick
griimick / template.cpp
Last active Apr 20, 2020
Competitive Programming C++ template
View template.cpp
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int32_t main() {
fastio
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
@griimick
griimick / profiles.json
Last active May 18, 2020
Windows Terminal config
View profiles.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{c6eaf9f4-32a7-5fdc-b5cf-066e8a4b1e40}",
"copyOnSelect": false,
"copyFormatting": false,
"launchMode" : "maximized",
"profiles":
{
"defaults":
{