Skip to content

Instantly share code, notes, and snippets.

View HazemNoor's full-sized avatar

Hazem Noor HazemNoor

View GitHub Profile
@medhatdawoud
medhatdawoud / rules-to-write-better-commit-messages.md
Last active March 8, 2024 17:25
This gist is the summary of a video on YouTube [in Arabic] you can watch from here: https://youtu.be/BTlL-LBDCSI

Rules to write a better commit message

These are my preferences for a good commit message, feel free to fork this gist and add your own standards, or add comment here to share yours with the community.

1. Include only the files related to the feature you are implementing:

  • Don't add any file that is not related to the main issue, you can make it in a separate commit.
  • Separating files that not related is important in the revert cases.
  • Revise the whole changes always before committing and make sure to mention each change you made in the message.

2. Commit subject should be concise and reflect the essence of the commit:

  • Imagine the commit as an Email to the owner or your team mates.
  • Subject in the first and main sentence of the commit, it should be concise and to the point.
  • It shouldn't exceed 50 char.
@Pierstoval
Pierstoval / _PHP is_a() vs is_subclass_of().md
Last active March 1, 2023 13:02
`is_a()` vs `is_subclass_of()`

PHP is_a() vs is_subclass_of()

To compute the results, just use Melody and run the script:

melody run https://gist.github.com/Pierstoval/ed387a09d4a5e76108e60e8a7585ac2d
@bittercoder
bittercoder / convert.sh
Last active March 28, 2024 18:54
Convert .heic files to .jpg on linux (coming from an iOS11 device over USB)
# download release from github: https://github.com/monostream/tifig/releases and install at ~/tools/tifig
# then run these commands in the folder (just to keep things simple we normalize the file extension case before proceeding).
for f in *.HEIC; do mv "$f" "`echo $f | sed s/.HEIC/.heic/`"; done
for file in *.heic; do echo "~/tools/tifig -v -p $file ${file/%.heic/.jpg}"; done
@AhmedKamal20
AhmedKamal20 / subl_last_commit.sh
Created February 24, 2018 01:49
Open all modified files of the last commit with Sublime Text
git diff-tree --no-commit-id --name-only -r HEAD | xargs subl
@sliceofbytes
sliceofbytes / txt-to-google-keep-notes.py
Created February 14, 2018 22:16
Add Text Files as Google Keep Notes
#Import a directory of text files as google keep notes.
#Text Filename is used for the title of the note.
import gkeepapi, os
username = 'username@gmail.com'
password = 'your app password'
keep = gkeepapi.Keep()
success = keep.login(username,password)
@pablorsk
pablorsk / CorsMiddleware.php
Last active August 15, 2020 20:23
CORS middleware for Lumen and PSR-7
<?php
namespace App\Http\Middleware;
use Closure;
class CorsMiddleware
{
/**
* Handle an incoming request.
@maxivak
maxivak / __upload_file.md
Last active April 4, 2024 10:07
PHP upload file with curl (multipart/form-data)

We want to upload file to a server with POST HTTP request. We will use curl functions.


// data fields for POST request
$fields = array("f1"=>"value1", "another_field2"=>"anothervalue");

// files to upload
$filenames = array("/tmp/1.jpg", "/tmp/2.png");
@skyrepprac
skyrepprac / gist:fe781b30e53f5e2aca99ff7e65013c37
Created July 12, 2017 06:16
Magento - Add Bundle Product Programmatically
<?php
require_once('includes/config.php');
require_once('app/Mage.php');
$storeID = 1;
$websiteIDs = array(1);
$cats = array(5);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
function wpex_minify_css( $css ) {
// Normalize whitespace
$css = preg_replace( '/\s+/', ' ', $css );
// Remove ; before }
$css = preg_replace( '/;(?=\s*})/', '', $css );
// Remove space after , : ; { } */ >
$css = preg_replace( '/(,|:|;|\{|}|\*\/|>) /', '$1', $css );
<html>
<body>
<canvas width="800" height="800" id="c" />
<script type="text/javascript">
function doit(){