Skip to content

Instantly share code, notes, and snippets.

View AydinHassan's full-sized avatar

Aydin Hassan AydinHassan

View GitHub Profile
@AydinHassan
AydinHassan / interceptor-return-type.patch
Created August 11, 2016 11:11
Magento 2 Interceptor with return type hints patch
From d5951cd822ae615c8ae56e1c92aae0a921ad611c Mon Sep 17 00:00:00 2001
From: Aydin Hassan <[email protected]>
Date: Thu, 11 Aug 2016 13:00:42 +0200
Subject: [PATCH] Patch interceptor generator to add return types, bring in
some zend-code 3 features
---
Generation/ClassGenerator.php | 37 +++++++++++++
Generation/Interceptor.php | 42 +++++++++++++++
Generation/MethodGenerator.php | 112 ++++++++++++++++++++++++++++++++++++++
@AydinHassan
AydinHassan / 0_reuse_code.js
Created July 7, 2016 09:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
<?php
namespace Hft\Font;
/**
* Class ImageTtfBbox
* @package Hft\Font
* @author Aydin Hassan <[email protected]>
*/
class Image
@AydinHassan
AydinHassan / add-magento-version.php
Last active February 15, 2024 08:18
Add a new version of Magento to a repository compatible with https://github.com/AydinHassan/magento-core-composer-installer
<?php
/**
* Script to manage to version of Magento in a git mirror
* php $argv[0] core-repository new-version-of-magento
*
* It will look for Mage.php in new-version-of-magento and parse the version
* and edition from it.
*
* It will copy the code, remove the old files, create new branches if necessary
<?php
if (file_exists('composer')) {
unlink('composer');
}
file_put_contents('composer', file_get_contents('https://getcomposer.org/download/1.0.0-alpha10/composer.phar'));
chmod('composer', 0777);
file_put_contents('composer.json', <<<EOF
@AydinHassan
AydinHassan / add-magento-version.php
Created December 8, 2014 23:30
A script to import new versions of Magento into a Magento mirror
<?php
/**
* Script to manage to version of Magento in a git mirror
* php $argv[0] core-repository new-version-of-magento
*
* It will look for Mage.php in new-version-of-magento and parse the version
* and edition from it.
*
* It will copy the code, remove the old files, create new branches if necessary
<?php
use Jh\DevSiteTool\Entity\HtPasswdUser;
require __DIR__ . "/vendor/autoload.php";
$sites = [
'site-name' => [
'name' => 'site-name',
'systemUser' => 'site-name',
@AydinHassan
AydinHassan / dump-mage-db.sh
Created July 14, 2014 15:14
Dump Remote Magento DB
#!/bin/bash
if [ -z "$1" ]; then
echo "Please enter SSH host as first parameter. Eg [email protected]"
exit 1
fi
sshHost=$1
if [ -z "$2" ]; then
//yours
function isNested(content, regex) {
var match = regex.exec(content);
if (match) {
return /%C(.+?):(.+?)%CR/g.exec(match[2]) ? true : false;
}
}
@AydinHassan
AydinHassan / gist:33b62ec0feba2f80b590
Last active August 29, 2015 14:01
ZF2 console route with minus number as parameter
Not sure if this is an issue or expected:
I have the following console route:
return [
'console' => [
'router' => [
'routes' => [
'set-user-starting-balance' => [
'options' => [