Skip to content

Instantly share code, notes, and snippets.

View palashmon's full-sized avatar
🎯
Focusing

Palash Mondal palashmon

🎯
Focusing
View GitHub Profile
@palashmon
palashmon / Readme.md
Created February 19, 2024 10:11
Enhanced Git Log Formatting

Enhanced Git Log Formatting

Overview

The git log command is a powerful tool for viewing the commit history of a Git repository. By default, it displays a detailed list of commits, including commit hashes, commit messages, author names, dates, and branch information. However, customizing the output format can make the log more informative and visually appealing.

In this gist, we'll explore two enhanced git log commands that use custom formatting to provide a clearer and more concise view of the commit history.


@palashmon
palashmon / Readme.md
Created February 19, 2024 08:30
Display A List Of Git Branches Ordered By Most Recent Commits

Display A List Of Git Branches Ordered By Most Recent Commits

This file provides commands to display a list of Git branches ordered by the 20 most recent commits, both locally and including remote branches. These commands are helpful for developers to easily track recent activity in the repository.

Show Local Git Branches

To view a list of local Git branches sorted by commit date, use the following command:

git for-each-ref --count=20 --sort=-committerdate refs/heads --format='%(authordate:short) %(color:red)%(objectname:short) %(color:yellow)%(refname:short)%(color:reset) (%(color:green)%(committerdate:relative)%(color:reset))'
@palashmon
palashmon / Readme.md
Last active July 28, 2024 15:34
Creating JSDoc `@types` for Different Data Types in JavaScript
@palashmon
palashmon / Child1Props.d.ts
Last active February 27, 2024 05:13
Creating and Importing Multiple TypeScript Declaration Files as a Single Index File
export interface Child1Props {
name: string;
languages: Array<string>;
}
@palashmon
palashmon / image-reset.css
Created November 17, 2023 07:44
A More Effective CSS Image Reset
/**
* This CSS block is a More Effective CSS Image Reset.
* It resets the default styles of an image element
* and adds some additional styles to improve its rendering.
*
* The `max-width: 100%;` ensures that the image does not exceed its container's width,
* while maintaining its aspect ratio with `height: auto;`.
*
* The `vertical-align: middle;` aligns the image vertically with the text.
*
@palashmon
palashmon / Prettify.ts
Created May 13, 2023 16:11
A super useful type helper in TypeScript by Matt Pocock from Twitter
/**
* A TypeScript type alias called `Prettify`.
* It takes a type as its argument and returns a new type that has the same properties as the original type,
* but the properties are not intersected. This means that the new type is easier to read and understand.
*/
type Prettify<T> = {
[K in keyof T]: T[K];
} & {};
@palashmon
palashmon / console-group.js
Created August 18, 2020 07:04
Simple grouping of messages using console.group() & console.groupEnd()
/**
* @file Simple grouping of messages in console
* @author Palash Mondal
*/
const url = new URL('http://example.com:3000/blog?startIndex=1&pageSize=10');
console.group("URL Details");
console.log(`Hostname: ${url.hostname}`);
console.log(`Pathname: ${url.pathname}`);
console.log(`Protocol: ${url.protocol}`);
@palashmon
palashmon / new-file-in-git-bash.md
Last active February 27, 2024 05:14
Create a new file in git bash

Usage

# You can simply type
> emptyfile.txt

# This will create a empty text file with name "emptyfile"
# This same as doing
echo "" > emptyfile.txt
@palashmon
palashmon / edit-message.md
Last active September 7, 2017 17:12
Edit last committed git message

Usage

# your initial message
git commit -m "Your old message here"

# some typo happened in last commited message
git commit --amend -m "Your edited message here"
@palashmon
palashmon / edit-pushed-message.md
Last active September 7, 2017 17:13
Editting the message of the most recently pushed commit

Usage

# your initial message
git commit -m "Your old message here"

# push the local changes to remote
git push example-branch

# some typo happened in recently pushed commit message