Skip to content

Instantly share code, notes, and snippets.

View gunjanpatel's full-sized avatar

Gunjan Patel gunjanpatel

View GitHub Profile
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active April 18, 2024 11:56
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@gunjanpatel
gunjanpatel / countries-phone.md
Created February 27, 2024 13:49
List of almost all countries phone number, min and max length, example and regex validation.

List of almost all countries phone number, min and max length, example and regex validation.

Europe:

Country Minimum Length Maximum Length Country Code Example Phone Number Regex Validation
Austria 7 13 +43 +4312345678901 ^+43\d{7,13}$
Belgium 9 10 +32 +32123456789 ^+32\d{9,10}$
Bulgaria 8 9 +359 +35912345678 ^+359\d{8,9}$
Croatia 8 11 +385 +385123456789 ^+385\d{8,11}$
Cyprus 8 10 +357 +35712345678 ^+357\d{8,10}$
@gunjanpatel
gunjanpatel / cloud.md
Created November 28, 2023 14:39
Comparison of all cloud products
Category AWS Azure Google Cloud
Compute EC2, Lambda, ECS, EKS, Fargate Virtual Machines, App Service, Functions Compute Engine, App Engine, Kubernetes
Storage S3, EBS, Glacier, EFS Blob Storage, File Storage, Disk Storage Cloud Storage, Persistent Disk, Filestore
Database RDS, DynamoDB, Aurora Azure SQL Database, Cosmos DB Cloud SQL, Cloud Spanner, Firestore
Networking VPC, Route 53, CloudFront Virtual Network, Traffic Manager VPC, Cloud DNS, Load Balancing
Identity & Access Management IAM, Cognito, KMS
@gunjanpatel
gunjanpatel / amazon-ec2-ftp.md
Last active October 10, 2023 15:31
amazon ec2 LAMP and FTP installation and setup

VS Code theme setting

Preview

Go

image

PHP

image

@gunjanpatel
gunjanpatel / 01-README.md
Last active June 12, 2023 01:12
JQuery plugin to observe appearance of the element. Intersection observer using jquery.

Usage

$('#observeMe').appearanceObserver({
    onAppeared: function () {
        // I am appeared callback
    },
    onDisappeared: function () {
        // I am disappeared callback
    }
});
@gunjanpatel
gunjanpatel / 1-readme.md
Last active April 13, 2023 12:35
Tailwind CSS - Calculating Briks to be used in pavering
@gunjanpatel
gunjanpatel / undo-last-commit.md
Last active February 14, 2023 11:22
Undo / Revert last commit while keeping files in stage

Here is how you undo your last commit and keep the changes from last commit files in stag or uncommited.

reset --soft HEAD^
@gunjanpatel
gunjanpatel / jdatabase.md
Last active November 14, 2022 12:26
Write subquery in Joomla 3 using JDatabase method.

Here is an example of how to write subquery in Joomla! 3 using JDatabase method.

<?php
// Initialize variables.
$db       = JFactory::getDbo();
$subQuery = $db->getQuery(true);
$query    = $db->getQuery(true);

// Create the base subQuery select statement.
@gunjanpatel
gunjanpatel / useful_commands_to_use_in_shell.md
Created April 17, 2020 16:03 — forked from jcarolinares/useful_commands_to_use_in_shell.md
This is a simple guide for non-pro bash users to do random but annoying tasks in just seconds

Useful commands to use in Shell or others:

This is a simple guide for non-pro bash users to do random but annoying tasks in just seconds

Your boss will be happy and you'll be less stressed ;)

PDFs

Search a phrase or keyword in multiple PDF: