Skip to content

Instantly share code, notes, and snippets.

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

Muhammad Sulaiman MuhammadSulaiman001

🏠
Working from home
View GitHub Profile
@MuhammadSulaiman001
MuhammadSulaiman001 / force-format-usb-drive.md
Last active February 25, 2024 05:42
solving "this disk is write protected"

I once had my USB flash drive back from one of my friends! an error message kept showing up everytime I try to format the USB! I Could not solve the issue through windows GUI, got it done with commandline

Open cmd as admin and run the following commands one by one

diskpart
list disk

take the number of the usb disk as a note, use it in the snippet below as an argument for select disk command,

@MuhammadSulaiman001
MuhammadSulaiman001 / submodule-workflow-example.md
Last active January 24, 2024 16:39
Git submodule workflow example

Git submodule workflow example..

Monday 10:00 AM. (adding the submodule to the base repo)

  • You have a project (exisiting repo), you want to add/host another repo inside your project..

    • This project might be yours, ex. you have a library and many projects that you want to use the library inside them, so you want to keep just one-updated copy of the library..
    • Or, You've forked a repo, You want to do frequent/many changes to the code and you want to keep up to date with the owners edits and bug fixes..
  • In your project (that will host the submodules):

Definition (Code Smells) Code smells are common code anti-patterns which could and should be refactored.

This doc is summarized from Martin Flower's book Refactoring (the 2nd Edition).

Refactoring is all about Change

  • You may inverse previous refactorings as software grows
  • You may change names of a function/parameter/varible/... as you learn

How to use this doc

Go to a section of code smell, and the refactoring techniques to that smell are written in Pascal Case under the Solution section. Refer to the book's catalog to get detailed examples and explainations for each refactoring technique.

Table of Code Smells

using System;
using System.Speech.Recognition;
namespace ConsoleApp
{
internal static class Program
{
private static void Main(string[] args)
{
// Create an in-process speech recognizer for the en-US locale.
@MuhammadSulaiman001
MuhammadSulaiman001 / xampp-setup.md
Created August 27, 2022 06:48 — forked from peterhurford/gist:8602d9fb334baa71d983
How to use XAMPP to test PHP on your own computer

So this is a guide for how to use XAMPP to test any PHP website on your own computer. Well, actually, it's more a guide of guides than an actual guide. I personally didn't find the process to be bad, but it also wasn't straightforward, and it involved a lot of googling separate problems. There was no One Guide for the Entire Process, but a bunch of separate things.

So I decided to put everything together. Here are the steps:

Step 1: Install XAMPP. Download from here.

Step 2: Set up XAMPP. Follow instructions here.

Step 3: Go to PhpMyAdmin and create any relevant MySQL tables, if any.

@MuhammadSulaiman001
MuhammadSulaiman001 / .gitignore
Last active August 22, 2022 08:56 — forked from kmorcinek/.gitignore
Example .gitignore file I use for C# projects
# The following command works for downloading when using Git for Windows:
# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
#
# Download this file using PowerShell v3 under Windows with the following comand:
# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore
#
# or wget:
# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore
# User-specific files
@MuhammadSulaiman001
MuhammadSulaiman001 / clean_code.md
Created August 20, 2022 09:50 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@MuhammadSulaiman001
MuhammadSulaiman001 / AdsExtensions.cs
Last active January 3, 2024 11:27
Update ui-bound variables via modern-reactive Twincat libs
using System;
using System.Collections.Generic;
using TwinCAT.Ads;
using TwinCAT.Ads.Reactive;
namespace Project.CncModule.Utils;
public static class AdsExtensions
{
private static readonly HashSet<IDisposable> AdsDisposables = new();
@MuhammadSulaiman001
MuhammadSulaiman001 / Git Branching Strategy.md
Created August 1, 2022 17:52 — forked from jpolete/Git Branching Strategy.md
Git/GitHub branching standards & conventions

Git Branching Strategy

Quick Legend

Branch Name Notes
Stable master Accepts merges from Release and Hotfix branches only.
Development develop Accepts merges from Feature/Bugfix, Release and Hotfix
Features/Bugfix feat-* / bug-* Always branch off HEAD of develop
Hotfix hotfix-* Always branch off master. Merges back into master and develop.