Skip to content

Instantly share code, notes, and snippets.

View mahmoudissmail's full-sized avatar

Mahmoud ismail mahmoudissmail

View GitHub Profile
@godriccao
godriccao / create.php
Last active June 3, 2021 15:37 — forked from TheFrankman/create.php
Programatically create an order in Magento 2.1
<?php
/**
* @author Godric Cao
*/
namespace Vendor\Namespace\Model\Subscription\Order;
class Create
{
public function __construct(
\Magento\Framework\App\Helper\Context $context,
@tomysmile
tomysmile / mac-php-composer-setup.md
Created July 11, 2016 10:45
Setup PHP Composer using Brew
@ozexpert
ozexpert / ionic2.image-cache.directive.ts
Last active February 21, 2024 11:13
AngularJS2 / Ionic2 : ImageCache Directive to use with imgcache.js
import { Directive, ElementRef, Input } from '@angular/core';
declare var ImgCache: any;
@Directive({
selector: '[image-cache]'
})
export class ImageCacheDirective {
constructor (
private el: ElementRef
@hslatman
hslatman / magento_custom_index.php
Last active November 1, 2019 11:55
Custom Magento re-indexing script
<?php
/******************************************************************************************************************
* Source: http://www.emvee-solutions.com/blog/magento-custom-reindex-script/
*
* Custom Magento re-indexing script
******************************************************************************************************************/
//Place this file in your Magento root folder, or modify the require once to match your directory.
@ghinda
ghinda / git-commit-csv-export.sh
Last active May 6, 2024 07:07
git csv export of commits in the last month
git log --since='last month' --pretty=format:'%h;%an;%ad;%s' --author='Ionut Colceriu' > ~/log.csv
@tegansnyder
tegansnyder / Magento-order-sum-breakout-report.sql
Created January 31, 2014 15:41
Magento - Sum of All Orders by Month and Year Breakdown includes Discount Sums
SELECT sub_query.month_ordered,
sub_query.year_ordered,
SUM(sub_query.base_subtotal) AS sum_base_subtotal,
SUM(sub_query.discount_amount) AS sum_discount_amt,
SUM(sub_query.order_qty) AS sum_total_item_count,
COUNT(sub_query.entity_id) AS total_orders
FROM
(SELECT so.entity_id,
MONTH(so.created_at) AS month_ordered,
YEAR(so.created_at) AS year_ordered,
@homaily
homaily / gist:8672499
Last active May 7, 2024 05:37
Regex to validate saudi mobile numbers

السلام عليكم ، هذا كود ريجيكس بسيط للتحقق من صحة أرقام الجوالات السعودية ، يقوم الريجيكس بالتحقق من مفتاح الدولة ، مفتاح شركة الإتصالات لضمان صحة النص المدخل .

Hello, this is a simple regex to validate saudi mobile numbers, the code will validate country code, telecome company code and make sure the tested sting is correct .

/^(009665|9665|\+9665|05|5)(5|0|3|6|4|9|1|8|7)([0-9]{7})$/

Regex Breakdown - شرح الكود

@tegansnyder
tegansnyder / CategoryTreePathExportMagento.php
Last active December 3, 2020 15:31
Export Category Tree and Paths for Magento
<?php
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
Mage::app();
$category = Mage::getModel ('catalog/category');
$tree = $category->getTreeModel();
$tree->load();
delimiter ;;
drop procedure if exists build_catalog;;
create procedure build_catalog(IN categories INT, IN products INT)
begin
SET @category_count = 1;
SET @CATNAMEPREFIX = "Category ";
SET @CATURLKEYPREFIX = "cat-";
SET @CATURLPATHPREFIX = "catpath-";
SET @ROOTCATEGORY = 2;
SET @INCLUDEINMENU = 1;
@parhamr
parhamr / 0: Magento 1.12 Enterprise multi-store cluster configuration.md
Last active October 13, 2023 14:20
A highly available, fault tolerant, distributed, and load balanced LEMP cluster.