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];
} & {};
@hubgit
hubgit / SelectField.tsx
Last active October 14, 2024 23:28
Use react-select with Formik
import { FieldProps } from 'formik'
import React from 'react'
import Select, { Option, ReactSelectProps } from 'react-select'
export const SelectField: React.SFC<ReactSelectProps & FieldProps> = ({
options,
field,
form,
}) => (
<Select
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
$space-inset-default = 16px 16px 16px 16px;
$space-inset-xs = 4px 4px 4px 4px;
$space-inset-s = 8px 8px 8px 8px;
$space-inset-m = 16px 16px 16px 16px;
$space-inset-l = 32px 32px 32px 32px;
$space-inset-xl = 64px 64px 64px 64px;
$space-stack-default = 0 0 16px 0;
$space-stack-xs = 0 0 4px 0;
$space-stack-s = 0 0 8px 0;
$space-stack-m = 0 0 16px 0;
@paulirish
paulirish / bling.js
Last active November 4, 2024 17:48
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;