Skip to content

Instantly share code, notes, and snippets.

View zubaer-ahammed's full-sized avatar
🏠
Working from home

Md. Zubaer Ahammed zubaer-ahammed

🏠
Working from home
View GitHub Profile
@zubaer-ahammed
zubaer-ahammed / Create Tag on a Branch (with branch name input, automatic tag name, prompt to create pull request).md
Last active February 6, 2025 11:07
Create Tag on a Branch (with branch name input, automatic tag name, prompt to create pull request)

Steps to Create the Script

  1. Create the Script File Open your terminal and create a new script file:
nano ~/create_tag.sh
  1. Add the following content to the file:
  2. Save and close the file by pressing Ctrl + O, then Enter, and then Ctrl + X.
@zubaer-ahammed
zubaer-ahammed / Git Pre-Commit Hook for Protecting Master, Main and Production Branches.md
Last active February 6, 2025 10:51
Git Pre-Commit Hook for Protecting Master, Main and Production Branches

🚀 Git Pre-Commit Hook for Protecting Master & Main Branches

A Git pre-commit hook that prevents accidental commits on protected branches (master, main, production).

🔥 Features

🔴 Warning when committing on a protected branch.
🟢 Option to proceed (yes) or discard uncommitted changes (discard).
🟡 Default is no (commit aborted unless explicitly confirmed).
📜 Logs commit attempts in ~/.git_commit_log.txt for auditing.
🎨 Color-coded output for better readability.

@zubaer-ahammed
zubaer-ahammed / woocommerce-select2-selectwoo-remove
Last active November 2, 2020 15:51 — forked from ontiuk/woocommerce-select2-selectwoo-remove
Woocommerce Remove Select2 / SelectWoo
// Add to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting
/**
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish
*/
function woo_dequeue_select2() {
if ( class_exists( 'woocommerce' ) ) {
wp_dequeue_style( 'select2' );
wp_deregister_style( 'select2' );
  1. Status in current branch: git status
  2. Show all remotes: git remote
  3. Check to see if you are up to date with the current branch: git fetch
  4. Switch to a different branch within current remote: git checkout branch_name (Example: git checkout master or git checkout zubaer)
  5. Switch to a different branch within a different remote: git branch -u remote_name/branch_name (Example: git branch -u production/master or git branch -u origin/master). It is important to provide -u. Otherwise, it will try to create a new Branch.
  6. Create a new Branch: git branch branch_name (Example: git branch zubaer).
  7. Show commit history: git log
  8. Git add all: git add .
  9. Git commit: git commit -m 'Commit text'
  10. Push to a branch: git push remote_name branch_name (Example: git push production master or git push origin master)
@zubaer-ahammed
zubaer-ahammed / flex frequently used classes.css
Created March 8, 2018 14:39
Frequently used flex css classes
.flex {
display: flex;
display: -webkit-flex;
display: -moz-flex;
}
.flex-row {
flex-direction: row;
}
@zubaer-ahammed
zubaer-ahammed / delete-orphans-usermeta.sql
Created March 2, 2018 19:24 — forked from carlosleopoldo/delete-orphans-usermeta.sql
Delete all orphans user meta in WordPress
DELETE FROM wp_usermeta
WHERE NOT EXISTS (
SELECT * FROM wp_users
WHERE wp_usermeta.user_id = wp_users.ID
)
@zubaer-ahammed
zubaer-ahammed / Reset MySQL Root Password in Mac OS.md
Last active February 14, 2025 13:37
Reset MySQL Root Password in Mac OS

Reset mysql root password in Mac OS:

First Stop MySQL:

  1. Go to: 'System Preferences' >> 'MySQL' and stop MySQL

OR,

  1. sudo /usr/local/mysql/support-files/mysql.server start
  2. sudo /usr/local/mysql/support-files/mysql.server stop
@zubaer-ahammed
zubaer-ahammed / Open Remote File in Sublime Text.md
Last active December 5, 2024 04:13
Open Remote File in Sublime Text (Linux Server) - Tested with Ubuntu

Open Remote File in Sublime Text:

I felt the importance of directly editing a file from a DigitalOcean droplet on my Ubuntu Server. I research on the internet and made a way to do it.

Local Machine Settings:

  1. Install "rsub" in your Sublime Text.
    • Hit Ctrl+Shift+P, start typing “install” and select “Install Package”
    • Start typing “rsub” and select it.
@zubaer-ahammed
zubaer-ahammed / Frequently Needed SSH Commands.md
Last active January 19, 2024 14:47
Frequently Needed SSH Commands ( Mostly Linux & Mac + PUTTY for windows)

Useful SSH Commands:

  1. first command: sudo whoami
  2. Create a file named "testfile": touch testfile
  3. make a directory named "testdir": mkdir testdir
  4. list or show all files and folders in a dir: ls
    • For showing hidden files also run this command with a flag: ls -a
  5. change directory: cd
  6. back on directory: cd ..
  7. go to the root directory: cd ~
@zubaer-ahammed
zubaer-ahammed / RunScheduler.php
Last active December 21, 2020 09:23 — forked from robbydooo/RunScheduler.php
Heroku Laravel Scheduler - Overcoming Heroku Scheduler's 10 minute minimum interval limit
<?php
/**
* This Scheduler will run once every minute unlike the Heroku scheduler which only runs every 10 mintues.
* To use this scheduler with Laravel 5.4+ add this file to /app/Console/Commands/RunScheduler.php
* Register this file in app/Console/Kernel.php
* protected $commands = [
* ...