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

git .mailmap file

Steps

  1. Use this good git alias
git config --global alias.summary '! git shortlog --summary --numbered --email --all --no-merges'
@MuhammadSulaiman001
MuhammadSulaiman001 / git-quick-stats on windows.md
Last active February 25, 2024 05:33 — forked from arzzen/cygwin-installer.sh
How to get "git-quick-stats" working on windows (using PowerShell)
  1. Setup,
# Clone the repo
git clone https://github.com/arzzen/git-quick-stats
# Move inside
cd git-quick-stats
# There is a file called "git-quick-stats", we'll add its path to .gitconfig file..

Useful newtonsoft utilities (3 files)

.vcxproj setup (best practices)

  1. Project Properties -> General:

    • Top dropdowns = "All configurations" and "All platforms",
    • C++ Language Standard = C++ 20
    • Output and Temp Directories (default location is at .sln level)
      • Set Output Directory to $(ProjectDir)$(Platform)\$(Configuration)
      • Set Temp Directory to $(ProjectDir)$(Platform)\Temp-$(Configuration)
  2. Headers:

To master a new technology (in 7 weeks?):

  • Learn native API first (weeks 1 and 2)
    • Don't start looking for libraries and frameworks until you understand how things are done in native API,
    • Don't learn from Youtube (it's a time killer) or any website other than the official website and official/top samples' repo!
    • Check the official docs and [technology-name]-samples repo side by side,
      • masters check ([technology-name] official repo as well
      • sometimes the samples are in [technology-name] official repo
  • Github topics (weeks 2, 3 and 4), see top 10/25 repos that uses the tag of [technology-name], check them, read the code, understand patters of how they do things in this technology (you will learn more than that, it will be a door opened to many other worlds of technologies, tools, build systems, etc...)
  • Stackoverflow (weeks 2, 3 and 4), watch the tag of that technology, keep an eye on the day-to-day questions, try to answer some questions, you will l

How Client Consume Service? C#

Approach 1. Pass the service as argument to client methods

  • Abstraction
public interface IService
{
      void DoFavor1();
@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