Skip to content

Instantly share code, notes, and snippets.

View unicoder88's full-sized avatar

Roman unicoder88

View GitHub Profile
@simpleadm
simpleadm / ApiDataInterface
Last active February 15, 2019 06:39
PhpStorm File and code templates for Magento 2
<?php
#parse("PHP File Header.php")
#set($current = "")
#set($MODULE_NAMESPACE = "")
#foreach($current in $MODULE_NAME.split("_"))
#set($MODULE_NAMESPACE = $MODULE_NAMESPACE + "\" + $current)
#end
namespace $MODULE_NAMESPACE.substring(1)\Api\Data;
/**
@Integralist
Integralist / Varnish VCL replace store query string and path into HTTP response headers.cs
Last active September 22, 2017 09:12
[Varnish VCL] use vcl to store provided query string and path into HTTP response headers #tags: vcl, varnish
vcl 4.0;
backend default {
.host = "www.vclfiddle.net";
.port = "80";
}
sub vcl_recv {
if (req.url ~ "(foo/bar)") {
set req.http.X-QS = regsub(req.url, "^[^?]+\?", ""); // good=hey&bad1=true&bad2=boop
@digitalpianism
digitalpianism / gist:14a15cd52baede0e5d600e8c653f33e9
Last active March 21, 2017 09:32
Diff between 1.9.3 and 1.9.2.4 + SUPEE-8788 / Don't mind the app/Mage.php autoloader patch ;)
diff --git a/.htaccess b/.htaccess
index aca7f55..63e1729 100644
--- a/.htaccess
+++ b/.htaccess
@@ -144,6 +144,21 @@
RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
RewriteRule .* - [L,R=405]
+<IfModule mod_setenvif.c>
+ <IfModule mod_headers.c>
@ometa
ometa / curl_all.sh
Last active September 27, 2023 20:38 — forked from antonbabenko/curl_all.sh
Curl list of urls and save http response code & times (useful for cache warmup)
#!/bin/bash
[ ! $1 ] && echo "you must include a file containing urls, one per line" && exit 1
while read LINE; do
curl -o /dev/null --silent --progress-bar --head --write-out '%{http_code} %{time_starttransfer} %{url_effective}\n' "$LINE"
done < $1
@edannenberg
edannenberg / magento_url_rewrite.patch
Last active August 11, 2022 17:27
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 5, 2023 21:58
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@incredimike
incredimike / variousCountryListFormats.js
Last active July 5, 2024 05:47
List of Countries in various Javascript data structures: Alphabetical country lists & Country data objects.
// Lists of countries with ISO 3166 codes, presented in various formats.
// Last Updated: July 30, 2020
// If you're using PHP, I suggest checking out:
// https://github.com/thephpleague/iso3166
// or Laravel: https://github.com/squirephp/squire
//
// JS developers can check out:
// https://www.npmjs.com/package/iso3166-2-db
//