Skip to content

Instantly share code, notes, and snippets.

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

Prashant Singh prashant1k99

🏠
Working from home
View GitHub Profile
@prashant1k99
prashant1k99 / Cryptic.ts
Created December 24, 2023 06:58
e2ee in Browser
const ENCRYPTION_KEY: any = 'your-encryption-key-here' // Must be 256 bits (32 characters) || Please use the above created shared key
const SharedKey = () => {
if (ENCRYPTION_KEY instanceof CryptoKey) return ENCRYPTION_KEY
return window.crypto.subtle.importKey(
'raw',
new TextEncoder().encode(ENCRYPTION_KEY),
'AES-GCM',
false,
['encrypt', 'decrypt']
@prashant1k99
prashant1k99 / SwiggyBills.js
Last active January 30, 2023 11:22
Reads all PDF from Dir and Generates CSV for Income Tax
import fs from 'fs'
import PDFParser from "pdf2json";
import { parseAsync } from 'json2csv'
const BillsTotal = []
const [_, __, path, portal] = process.argv
const config = {
amount: portal === 'zomato' ? "Total" : "Invoice%20Total",
@prashant1k99
prashant1k99 / stack.js
Created December 27, 2020 11:21
Stack implementation with Array
class Stack {
constructor(val) {
if (!val) {
throw new Error('Please set the max for the stack')
}
this.max = val
this.__data__ = []
}
get __isFull() {
return this.__data__.length == (this.max - 1)
@prashant1k99
prashant1k99 / linkedList.js
Created December 27, 2020 11:02
LinkedList Implementation in Js
class Node {
constructor(val) {
this.prev = null
this.val = val
this.next = null
}
}
class LinkedList {
constructor() {
@prashant1k99
prashant1k99 / generate-uuid.js
Last active December 28, 2022 18:16
To generate UUID in Js without any library
Date.now().toString(36) + Math.random().toString(36).substring(2,10)
// Another way
crypto.randomUUID()
@prashant1k99
prashant1k99 / map-polyfill.js
Last active December 26, 2020 13:51
Polyfill for the Map in Js
class BetterMap {
constructor(init) {
this.clear()
if (init)
for (var i = 0; i < init.length; i++)
this.set(init[i][0], init[i][1])
}
clear() {
this._map = {}
this._keys = []
@prashant1k99
prashant1k99 / js_concept.md
Created December 9, 2020 03:38
📜 33 concepts every JavaScript developer should know.


33 Concepts Every JS Developer Should Know

33 Concepts Every JavaScript Developer Should Know

Follow me

ProseMirror for dummies

This repo used to be a simple cookbook but I decided to convert this repo into "ProseMirror for dummies". In part because I wil most likely forget all the info written here, and in part because I'd like to help you, dear reader, in your struggle to use this library which is not for the faint of heart.

This is a work in progress. If you have any suggestion, please do not hesitate to create an issue or a PR.

Also, check the ProseMirror Utils repo by Atlassian. Not only it is useful per se, but the source code offers a lot of information on how to to certain things.

Basics

Triggering changes from the keyboard

@prashant1k99
prashant1k99 / add-rsync-to-git-bash.md
Created November 6, 2020 07:20 — forked from hisplan/add-rsync-to-git-bash.md
Add rsync to git bash for windows
@prashant1k99
prashant1k99 / docker_wordpress.md
Created August 12, 2020 05:27 — forked from bradtraversy/docker_wordpress.md
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes