Skip to content

Instantly share code, notes, and snippets.

View soccerian's full-sized avatar
🏠
Working from home

soccerian

🏠
Working from home
View GitHub Profile
@soccerian
soccerian / readme.MD
Last active February 26, 2024 12:49
Common Github Commands

Let's assume that you are working on react-frontend repository. And you have branches - master, develop, feature/auth, bugfix/fix-errors-on-social-auth, feature/RF-713. The examples on the below table will be written with the above repository name and branch names.

Command Example Description
git init initializes your local directory as a new git repository. You must run this before you can commit any of your work.
git status shows the current status of your repo. It will show you if you have any work that is unstaged, what branch you are on, how many commits you are ahead of the master remote on github, and other useful things.
git diff shows you the changes in your unstaged code.
@soccerian
soccerian / terminal-prompt-git-branch-zsh.md
Created March 17, 2023 20:24 — forked from reinvanoyen/terminal-prompt-git-branch-zsh.md
Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

Add Git Branch Name to Terminal Prompt (MacOS Catalina zsh)

Updated for MacOS Big Sur | Monterey | Ventura

screenshot

Install

Open ~/.zshrc in your favorite editor and add the following content to the bottom.

function parse_git_branch() {
@soccerian
soccerian / longest_palindrome.py
Created April 20, 2022 16:18
Get longest palindrome from a string
def longest_palindrome(s) -> str:
# Create a string to store our resultant palindrome
palindrome = ''
# loop through the input string
for i in range(len(s)):
# loop backwards through the input string
for j in range(len(s), i, -1):
@soccerian
soccerian / str_reduction.py
Last active April 20, 2022 16:19
String Reduction in Python
def str_reduction(strParam):
i = 0
ex_str = {
"ab": "c",
"ba": "c",
"bc": "a",
"cb": "a",
"ac": "b",
"ca": "b"
}