Skip to content

Instantly share code, notes, and snippets.

@zeloc
zeloc / 0_reuse_code.js
Created April 13, 2014 14:47
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
@zeloc
zeloc / order_notes.sql
Created August 16, 2018 08:11
sql to get all sales order notes in magento 2
select `order`.`increment_id` as `Sales Order`, DATE(`note`.`created_at`) as `Date`, TIME(`note`.`created_at`) as `Time`, `note`.`comment` as `Note`
FROM `sales_order` AS `order`
JOIN `sales_order_status_history` as `note`
ON `note`.`parent_id` = `order`.`entity_id`;
@zeloc
zeloc / mysqldump.sh
Created August 16, 2018 08:13
mysqldump command with host and gz
# Taking a mysqldump with single transation:
# standard
mysqldump --single-transaction -u root -proot bettys_local > bak_060618.sql.gz
# with host
mysqldump --single-transaction -h 127.0.0.1 -u root -proot bettys_local > bak_060618_1.sql.gz
# with gz and host
mysqldump --single-transaction -h 127.0.0.1 -u root -proot bettys_local | gzip > bak_060618_11.sql.gz
@zeloc
zeloc / upload_download.sh
Created August 16, 2018 08:14
upload and download via scp
//Download From the server to your local
scp -P 2020 coxandcox@78.137.125.4:/home/coxandcox/stg.temp.db.sql.gz /Users/doug/Downloads/
//Upload From your machine to the server
scp -P 2020 /Users/doug/Downloads/rugs-buying-guide.pdf coxandcox@78.137.125.1:/home/coxandcox/production/pub/media/
@zeloc
zeloc / change_user_pass.sql
Created August 16, 2018 08:14
Changes the user password in magento 2
SET @email='testspace@test.com', @passwd='Test@123456', @salt=MD5(RAND());
UPDATE customer_entity
SET password_hash = CONCAT(SHA2(CONCAT(@salt, @passwd), 256), ':', @salt, ':1')
WHERE email = @email;
@zeloc
zeloc / magento2_upgrade_script_fields.txt
Created August 16, 2018 08:15
This is a list of fields used during upgrading an attribute
2018-05-10T07:56:38+00:00 INFO (6): Array
(
[attribute_id] => Array
(
[SCHEMA_NAME] =>
[TABLE_NAME] => eav_attribute
[COLUMN_NAME] => attribute_id
[COLUMN_POSITION] => 1
[DATA_TYPE] => smallint
[DEFAULT] =>
@zeloc
zeloc / xdebugoffon.sh
Created August 16, 2018 08:16
unfinished
#!/bin/bash
# Simple script to enable or disable xdebug profiling
case $1 in
on)
sudo sed -i 's/;//g' /etc/php.d/xdebug.ini
sudo /etc/init.d/php-fpm restart
;;
off)
sudo sed -i 's/^/;/g' /etc/php.d/xdebug.ini
@zeloc
zeloc / bundlesitems.php
Created August 16, 2018 08:16
magento get bundle selected
<?php
//ini_set('memory_limit','10G');
require_once('abstract.php');
class Bundle_Cart_Item_Option_Items extends Mage_Shell_Abstract
{
/**
* Entry point
*/
public function run()
<?php
namespace Haakym\UKBankHoliday;
use JsonSerializable;
class UKBankHoliday implements JsonSerializable {
protected $year;
protected $newYears;
protected $goodFriday;
protected $easterMonday;
protected $mayDay;
protected $whitSun;
@zeloc
zeloc / observer.php
Created August 16, 2018 08:17
magento observer magento 1
<?php
use Varien_Event_Observer as Event;
class Test_PriceFilter_Model_Observer
{
public function catalogControllerCategoryInitAfter(Event $event)
{
//code goes here