Skip to content

Instantly share code, notes, and snippets.

View shravankb's full-sized avatar
💤
Brain is forever a nerd

Shravan Kumar B shravankb

💤
Brain is forever a nerd
View GitHub Profile
@shravankb
shravankb / INSTRUCTIONS.md
Created September 9, 2021 16:38 — forked from franklsm1/INSTRUCTIONS.md
Auto configure pre-commit hooks for a Gradle Spring App

Steps

  1. create a file called "pre-commit" with no extension in the project directory root
  2. add the code from the pre-commit file below into that new file
  3. create a new file called "preCommit.gradle" inside of the root gradle folder
  4. add the code from the preCommit.gradle file below into that new file
  5. add the following line at the end of the build.gradle file:
    • apply from: "$projectDir/gradle/preCommit.gradle"

Now when you run the ./gradlew build command the git pre-commit hook will be automatically setup.

@shravankb
shravankb / System Design.md
Created February 17, 2021 12:00 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@shravankb
shravankb / GitCommitEmoji.md
Created December 20, 2020 20:19 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
[
{
"quote":"When you are falling off a cliff... it doesn't matter you land on your face or your ass...",
"author":"shravan20"
},
{
"quote":"Perception is quite deceptive concept.",
"author":"shravan20"
},
{
import mongoose from 'mongoose';
export type TWithSoftDeleted = {
isDeleted: boolean;
deletedAt: Date | null;
}
type TDocument = TWithSoftDeleted & mongoose.Document;
const softDeletePlugin = (schema: mongoose.Schema) => {
@frankhu-2021
frankhu-2021 / Regex for Phone numbers
Created January 6, 2019 01:44
Regex for Phone numbers
1. xxx-xxx-xxxx grep -o '[0-9]\{3\}\-[0-9]\{3\}\-[0-9]\{4\}' file.txt
2. (xxx)xxx-xxxx grep -o '([0-9]\{3\})[0-9]\{3\}\-[0-9]\{4\}' file.txt
3. xxx xxx xxxx grep -o '[0-9]\{3\}\s[0-9]\{3\}\s[0-9]\{4\}' file.txt
4. xxxxxxxxxx grep -o '[0-9]\{10\}' file.txt
grep -o '\([0-9]\{3\}\-[0-9]\{3\}\-[0-9]\{4\}\)\|\(([0-9]\{3\})[0-9]\{3\}\-[0-9]\{4\}\)\|\([0-9]\{10\}\)\|\([0-9]\{3\}\s[0-9]\{3\}\s[0-9]\{4\}\)' file.txt
- Found online, and put on my git for reference.
Credit goes to Raullen Chai
on
@vxhviet
vxhviet / regex.md
Created August 8, 2017 04:03
Regular Expression to find a string included between two characters while EXCLUDING the delimiters

Source: StackOverflow

Question: Regular Expression to find a string included between two characters while EXCLUDING the delimiters

Answer:

Easy done:

(?<=\[)(.*?)(?=\])

@2fd
2fd / middleware.ts
Last active March 20, 2023 17:17
simple Middleware implementation in typescript
export class Middleware {
middlewares: any[];
constructor(middlewares: any[] = []) {
this.middlewares = middlewares;
}
next(current: number, ...args: any[]): any {
@thegitfather
thegitfather / vanilla-js-cheatsheet.md
Last active March 7, 2026 11:26
Vanilla JavaScript Quick Reference / Cheatsheet
@vasanthk
vasanthk / System Design.md
Last active March 13, 2026 10:40
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?