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 / bling.js
Created July 12, 2017 14:50 — forked from paulirish/bling.js
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;
@palashmon
palashmon / bling-0.2.0.js
Created July 12, 2017 15:06
bling dot js [updated]
// based on https://gist.github.com/paulirish/12fb951a8b893a454b32
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@palashmon
palashmon / git synced forked repo.md
Last active September 7, 2017 17:15
Make your forked repo master to be the same as upstream/master

Usage

git fetch upstream
git reset --hard upstream/master
git push origin master --force
@palashmon
palashmon / create new branch.md
Last active September 7, 2017 17:14
Create a new branch for adding a new feature to master

Usage

# create and switch to new branch, in one line 
git checkout -b new-branch-name

# add new changes to the code, after all done check status
git status

# add new files if needed
@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 
@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 / 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 / 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 / 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 / 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.
*