Skip to content

Instantly share code, notes, and snippets.

View nttan's full-sized avatar

Nguyen Tan nttan

View GitHub Profile
@nttan
nttan / Magento 2 - Create composer patch without git commit
Last active May 26, 2023 22:54
Magento 2 - Create composer patch without git commit
I use this method for creating patch, hope it helps . Let suppose you will modify this file
vendor/magento/module-customer/Block/CustomerData.php
Create a copy of that file whith your changes on it :
vendor/magento/module-customer/Block/CustomerDataModified.php
#################################
What you need to do is run this command :
@nttan
nttan / add-checkout-form-key.sh
Created December 24, 2019 18:18 — forked from schmengler/add-checkout-form-key.sh
Magento SUPEE-9767 Checkout Form Key Theme Patch
find -L app/design/frontend -regex '.*\(shipping\|billing\|shipping_method\|payment\).phtml' -exec grep -L formkey {} \; \
| xargs sed -i 's/<\/form>/<?php echo $this->getBlockHtml("formkey") ?><\/form>/g'
find -L skin/frontend -name 'opcheckout.js' -exec grep -L form_key {} \; \
| xargs sed -i 's/if (elements\[i\].name=='\''payment\[method\]'\'') {/if (elements[i].name=='\''payment[method]'\'' || elements[i].name == '\''form_key'\'') {/g'
@nttan
nttan / optimg.sh
Created July 3, 2019 07:15 — forked from sergeylukin/optimg.sh
Shell script for JPGs and PNGs optimization
#!/usr/bin/env sh
#
# This script automates images optimization
# is mainly used by a developer who manually
# can execute it when adding new images to the
# project
#
# Download and compile following binaries:
#
# - [jpegtran](http://www.ijg.org/)
https://github.com/topics/magento2-module
@nttan
nttan / or-example.php
Created July 27, 2018 02:49 — forked from Vinai/or-example.php
SearchCriteria OR Example for Magento 2
<?php
declare(strict_types = 1);
namespace Training5\VendorRepository\Controller\Test;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\Filter;
use Magento\Framework\Api\FilterBuilder;
@nttan
nttan / gist:04c06dce2807a96a272e00089bfc7df8
Created May 17, 2018 06:21 — forked from bryhal/gist:4129042
MYSQL: Generate Calendar Table
DROP TABLE IF EXISTS time_dimension;
CREATE TABLE time_dimension (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
db_date DATE NOT NULL,
year INTEGER NOT NULL,
month INTEGER NOT NULL, -- 1 to 12
day INTEGER NOT NULL, -- 1 to 31
quarter INTEGER NOT NULL, -- 1 to 4
week INTEGER NOT NULL, -- 1 to 52/53
day_name VARCHAR(9) NOT NULL, -- 'Monday', 'Tuesday'...
elasticsearch-php
=================
[![Build Status](https://img.shields.io/travis/elastic/elasticsearch-php.svg?style=flat-square)](https://travis-ci.org/elastic/elasticsearch-php)
Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because of this it tries to be opinion-free and very extendable.
To maintain consistency across all the low-level clients (Ruby, Python, etc), clients accept simple associative arrays as parameters. All parameters, from the URI to the document body, are defined in the associative array.
SELECT `main_table`.* FROM `quote` AS `main_table` WHERE (`is_active` = '1') AND (`items_count` > 0) ORDER BY entity_id DESC
############################################
$this->_logger->info(sprintf("Start cron update Quote - Total: %s", implode(',',$quotes->getColumnValues('entity_id'))));
// echo 'SM\Quote\Model\Observer';die;
// die;
foreach ($quotes as $quote) {
$items = $quote->getAllVisibleItems();
// echo get_class($items);die;
if (sizeof($items) > 0) {
http://www.integralist.co.uk/posts/git-tips.html
@nttan
nttan / salesforce.js
Created October 19, 2015 04:41 — forked from mobyjames/salesforce.js
Squarespace Forms Integration for Salesforce
Y.namespace('Template').Salesforce = Class.create({
/*
baseUrl
oid
sqsFormSubmit
*/
initialize: function (config) {
this.config = config;
},