Skip to content

Instantly share code, notes, and snippets.

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

Sachin Kumar Rajput skrmain

🏠
Working from home
  • India
  • 04:22 (UTC +05:30)
View GitHub Profile
@skrmain
skrmain / .editorconfig
Created October 21, 2025 03:59
Editor Config
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
@skrmain
skrmain / SetupScripts.md
Last active February 17, 2022 18:12
Setup Scripts
@skrmain
skrmain / FrontendCodeSnippets.md
Last active February 14, 2022 16:15
Frontend Code Snippets

Type for setTimeOut

let interval: null | ReturnType<typeof setTimeout> = null;

const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

CSS Media Queries

@skrmain
skrmain / .gitpod.yml
Created January 26, 2022 09:36
GitPod Configuration
vscode:
extensions:
- streetsidesoftware.code-spell-checker
- codezombiech.gitignore
- eamodio.gitlens
- yzhang.markdown-all-in-one
- esbenp.prettier-vscode
@skrmain
skrmain / MulterFileUpload-Example.md
Last active March 16, 2025 11:32
ExpressJS Mutler File Upload(typescript)

File Upload Using Multer

// npm i multer
// make a folder before uploading the images
// server.js
const express = require("express");
const multer = require("multer");
const path = require("path");
const app = express();
@skrmain
skrmain / getting_value_from_nested_dictonary.py
Created October 1, 2021 08:27
Python Code to get value from nested dictonary
# Python Method to get the Value from nested dictionary
from functools import reduce
def deep_get(dictionary, keys, default=None):
return reduce(lambda d, key: d.get(key, default) if isinstance(d, dict) else default, keys.split("."), dictionary)
person = {'person': {'name': {'first': 'John'}}}
@skrmain
skrmain / windows-sublime-keymap.json
Created September 12, 2021 03:16
Custom - Windows Sublime keymap
[
{
"keys": ["alt+up"], "command": "swap_line_up"
},
{
"keys": ["alt+down"], "command": "swap_line_down"
},
{
"keys": ["ctrl+shift+down"], "command": "duplicate_line"
},
@skrmain
skrmain / main.py
Created August 31, 2021 09:01
Python Email Validation using Regex
import re
EMAIL_REGEX = r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
def is_email_valid(email):
if(re.search(EMAIL_REGEX, email)):
return True
else:
return False
@skrmain
skrmain / package.json
Last active May 9, 2021 03:00
Static ExpressJS Server
{
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"engines": {
"node": "14.16.1"
@skrmain
skrmain / add_token_in_postman_collection.js
Created May 1, 2021 08:46
Postman Test to add collection variable on success login
pm.test("Set Access Token", () => {
pm.expect(pm.response.code).to.equal(201)
const jsonData = JSON.parse(responseBody);
console.log("JSJS: ", jsonData)
pm.collectionVariables.set("ACCESS_TOKEN", jsonData.access_token);
})