Skip to content

Instantly share code, notes, and snippets.

View RazaChohan's full-sized avatar

Muhammad Raza RazaChohan

View GitHub Profile
@RazaChohan
RazaChohan / array-intersection.php
Created June 3, 2020 14:03
Find intersection of array
$arr1 = ['a', 'b', 'c'];
$arr2 = ['b', 'c', 'd'];
$intersectionArray = [];
foreach($arr2 as $key => $char) {
$arr2[$char] = $char;
unset($arr2[$key]);
}
foreach($arr1 as $char) {
if(isset($arr2[$char])) {
@RazaChohan
RazaChohan / my-travels.md
Created July 28, 2019 09:05 — forked from nouman91/my-travels.md
Useful libraries and solution I found

My travels

I have been working in JavaScript area for over five years, and in those years I have come across various different problems and implemented solutions for them. I have also studied JavaScript extensively and used many of open source libraries. My aim with this gist is to share my knowledge with you. In this gist I will be sharing many different useful resources which I have used and studied over the years.

Table of Contents

  • Design system
  • Front-end libraries
  • General purpose libraries
  • Back-end libraries
  • Unit test cases libraries
@RazaChohan
RazaChohan / .htaccess
Created January 20, 2017 14:04 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@RazaChohan
RazaChohan / xdebug_installation_on_linux.md
Created January 3, 2017 06:25 — forked from MAnfal/xdebug_installation_on_linux.md
Walkthrough for installing xdebug for php 7 on linux and enabling its support for phpstorm.

Xdebug Installation

Please follow the following steps to configure Xdebug on Linux.


Tested on

#C# Coding Standards

###Refactoring

Embrace refactoring! Make code refactorable by adding tests using TDD. Really TDD exists to allow refactoring.

The term code smell comes from Martin Fowler's book Refactoring. If you haven't already, read this book. The examples are in Java but they easily translate to C#. Don't write new code that has smells by refactoring them out. Here is a list of the most egregious smells:

  • Duplicated code.
  • Long Method.
@RazaChohan
RazaChohan / .Net + C# Learning Resources.md
Last active November 4, 2015 11:48
Learning resources for .Net Framework and C# coding standards

#Working on it

@RazaChohan
RazaChohan / docblock.txt
Last active August 29, 2015 14:24
php docblock
/**
* Quotes arg2 into arg1
*
* This method quotes the integer carried by arg2 into the string
* carried by arg1. This method uses the PHP function sprintf
* and returns the resulting string. FALSE if the integer was 0.
*
* @param string $arg1 the string to quote
* @param int $arg2 an integer containing some value to quote.
* Indent to the description's starting point

Fetch all branches :

$ git branch -r | grep -v HEAD | awk -F'/' '{print $2 " " $1"/"$2}' | xargs -L 1 git branch -f --track 
$ git fetch --all 
$ git pull --all 
$ git checkout -b [name_of_your_new_branch]
@RazaChohan
RazaChohan / eloquent.md
Last active August 29, 2015 14:20 — forked from msurguy/eloquent.md

Conventions:

Defining Eloquent model (will assume that DB table named is set as plural of class name and primary key named "id"):

class Shop extends Eloquent {}

Using custom table name

protected $table = 'my_shops';

@RazaChohan
RazaChohan / zsh.md
Last active February 21, 2019 09:41 — forked from tsabat/zsh.md