Skip to content

Instantly share code, notes, and snippets.

View ktajpuri's full-sized avatar

kamlesh tajpuri ktajpuri

View GitHub Profile
@ktajpuri
ktajpuri / pre-commit-hook.txt
Created September 15, 2023 06:24
Add a pre commit hook for the format of git message
1. cat > .git/hooks/pre-commit
#!/bin/bash
# Extract the commit message from the last commit
commit_message=$(git log --format=%B -n 1 HEAD)
# Check if commit message contains a JIRA ID
if [[ ! $commit_message =~ [A-Z]+-[0-9]+ ]]; then
echo "Error: Commit message must include a JIRA ID."
This file has been truncated, but you can view the full file.
{"v":"5.5.7","meta":{"g":"LottieFiles AE 0.1.20","a":"","k":"","d":"","tc":""},"fr":29.9700012207031,"ip":0,"op":362.000014744562,"w":4026,"h":3815,"nm":"group","ddd":0,"assets":[{"id":"image_0","w":500,"h":500,"u":"","p":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAH0CAYAAADL1t+KAAAgAElEQVR4Xu3d/Y+cZbkH8Ht3S2kBpZQ30QotqRYLWwdP5JioscSEHANRTM7vcv4C+Q8O/gXiXyD+ZOIvojE5JybGEiU5hx9kYEulHCIUaCsvQpfXprCdk2vorLPT6e7cs9PZZ6/9PMkGaJ9n5r4+102++7zPFAsBAgQIECCw6QVmNn0FCiBAgAABAgSKQDcJCBAgQIBAAgGBnqCJSiBAgAABAgLdHCBAgAABAgkEBHqCJiqBAAECBAgIdHOAAAECBAgkEBDoCZqoBAIECBAgINDNAQIECBAgkEBAoCdoohIIECBAgIBANwcIECBAgEACAYGeoIlKIECAAAECAt0cIECAAAECCQQEeoImKoEAAQIECAh0c4AAAQIECCQQEOgJmqgEAgQIECAg0M0BAgQIECCQQECgJ2iiEggQIECAgEA3BwgQIECAQAIBgZ6giUogQIAAAQIC3RwgQIAAAQIJBAR6giYqgQABAgQICHRzgAABAgQIJBAQ6AmaqAQCBAgQICDQzQECBAgQIJBAQKAnaKISCBAgQICAQDcHCBAgQIBAAgGBnqCJSiBAgAABAgLdHCBAgAABAgkEBHqCJiqBAAECBAgIdHOAAAECBAgkEBDoCZqoBAIECBAgINDNAQIECBAgkEBAoCdoohIIECBAgIBANwcIECBAgEACAYGeoIlKIECAAAECAt0cIECAAAECCQQEeoImKoEAAQIECAh0c4AAAQI
{"v":"5.6.5","fr":60,"ip":0,"op":120,"w":48,"h":48,"nm":"14 Heart","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.2,"y":1},"o":{"x":0.2,"y":0},"t":24,"s":[23.875,28.549,0],"to":[0,-1.5,0],"ti":[0,2.125,0]},{"i":{"x":0.7,"y":1},"o":{"x":0.3,"y":0},"t":32,"s":[23.875,19.549,0],"to":[0,-2.125,0],"ti":[0,-0.875,0]},{"i":{"x":0.8,"y":1},"o":{"x":0.8,"y":0},"t":48,"s":[23.875,15.799,0],"to":[0,0.875,0],"ti":[0,-1.5,0]},{"t":56,"s":[23.875,24.799,0]}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"gr","it":[{"ind":0,"ty":"sh","ix":1,"ks":{"a":0,"k":{"i":[[0,0],[0,0]],"o":[[0,0],[0,0]],"v":[[0.625,0],[9.25,0]],"c":false},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":1,"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic
@ktajpuri
ktajpuri / macro-micro-task-noqueue.js
Last active June 14, 2020 04:46
macro micro task
console.log(1)
setTimeout(() => {
console.log(2)
});
Promise.resolve().then(() => console.log(3))
console.log(4)
@ktajpuri
ktajpuri / recursion
Last active January 27, 2020 14:18
Reverse a string using recursion
ES5
function strRev(str) {
if(str.length === 1) {
return str;
}
return str.charAt(str.length-1) + strRev(str.substr(0, str.length-1))
}
ES6
const strRev = str => str.length === 1 ? str : str.charAt(str.length-1) + strRev(str.substr(0, str.length-1));
@ktajpuri
ktajpuri / Useful aliases for bash
Created June 10, 2019 12:46
useful aliases for bash
alias s='git status'
alias b='git branch'
alias p='git pull'
alias a='git add .'
co () { git checkout "$@"; }
m () { git commit -m "$@";}
@ktajpuri
ktajpuri / change bash prompt for git
Last active June 10, 2019 15:00
change bash prompt for git
Purple="\[\033[0;35m\]" # Purple
BIGreen="\[\033[1;92m\]" # Green
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
alias s='git status'
alias b='git branch'
alias p='git pull'
alias a='git add .'
co () { git checkout "$@"; }
m () { git commit -m "$@"; }
@ktajpuri
ktajpuri / how-this-differs-in-arrow-functions.js
Created February 26, 2019 12:58
how-this-differs-in-arrow-functions
this.myVar = "outer";
var obj = {
myVar: "inner",
myFunc1: function() {
console.log(this.myVar);
},
myFunc2: () => {
console.log(this.myVar);
},
// Say you have this function
function demo() {
var a = 1;
let b = 2;
if (1) {
var c = 3;
let d = 4;
console.log(a, b, c, d);
}
console.log(a, b, c, d);
class Person {
constructor(name, age) {
this.name = name;
this.age = age;
}
printIdentity() {
return "Mr. " + this.name;
}
testFunc() {
console.log("I am test from person");