Skip to content

Instantly share code, notes, and snippets.

View diazwatson's full-sized avatar

Raul Watson diazwatson

View GitHub Profile
@diazwatson
diazwatson / magento2-clear.sql
Created March 12, 2020 23:42 — forked from sergiojovanig/magento2-clear.sql
Magento 2 Clear Database
##########################################################
# PRODUCTS
##########################################################
DELETE FROM `catalog_product_bundle_option`;
DELETE FROM `catalog_product_bundle_option_value`;
DELETE FROM `catalog_product_bundle_selection`;
DELETE FROM `catalog_product_entity_datetime`;
DELETE FROM `catalog_product_entity_decimal`;
DELETE FROM `catalog_product_entity_gallery`;
DELETE FROM `catalog_product_entity_int`;
@diazwatson
diazwatson / build_adobe_stock.sh
Created October 27, 2019 11:09
A bash script to setup adobe stock
#!/bin/bash
PROJECTS_DIR=Sites
MAGENTO2_REPO=git@github.com:magento/magento2.git
MAGENTO2_FORK=git@github.com:diazwatson/magento2.git
ADOBESTOCK_REPO=git@github.com:magento/adobe-stock-integration.git
ADOBESTOCK_FORK=git@github.com:diazwatson/adobe-stock-integration.git
ADMIN_USER=USERNAME
ADMIN_PASS=PASSWORD
#!/bin/bash
PROJECTS_DIR=Sites
MAGENTO2_REPO=git@github.com:magento/magento2.git
MAGENTO2_FORK=git@github.com:diazwatson/magento2.git
ADOBESTOCK_REPO=git@github.com:magento/adobe-stock-integration.git
ADOBESTOCK_FORK=git@github.com:diazwatson/adobe-stock-integration.git
ADMIN_USER=jondoe
ADMIN_PASS=magento123
@diazwatson
diazwatson / InstallData.php
Created August 31, 2018 14:19
Magento2 UK and Ireland Counties for Region Addresses (SetupScript)
<?php
namespace Vendor\ModuleName\Setup;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
// This is how you would use it. Pass in your collection
// along with an individual callback as well as a batch callback
Mage::getSingleton('stcore/resource_iterator_batched')->walk(
$collection,
array($this, 'batchIndividual'),
array($this, 'batchAfter'),
self::BATCH_SIZE
);
public function batchIndividual($model)
@diazwatson
diazwatson / magento.conf
Created March 14, 2018 20:16 — forked from jonathonbyrdziak/magento.conf
A configuration file for magento under nginx.
#####################################################
#
# Provided by the Magento Support Center
# http://magentosupport.help/knowledgebase/configuring-nginx-to-work-with-magento-advanced/
#
# Your Magento Tutorial specialists
#
server {
listen *:8080;
server_name fanatik.redrokk.com www.fanatikbike.com fanatikbike.com;
filter:
paths: ["app/code/{vendor-name-goes-here}/*", "vendor/{vendor-name-goes-here}/*"]
excluded_paths:
- "vendor/{vendor-name-goes-here}/{module-name-goes-here}/*"
- "app/code/{vendor-name-goes-here}/{module-name-goes-here}/*"
- '*.min.js'
before_commands:
tools:
php_code_sniffer:
config: { standard: 'Zend,PSR-1,PSR-2' }
@diazwatson
diazwatson / Magento 1.x Orphaned Records Cleanup.md
Created August 30, 2017 16:39 — forked from dfelton/Magento 1.x Orphaned Records Cleanup.md
Deletes orphaned records from a Magento 1.x database.

Purpose

The purpose of this SQL script is to clean up a Magento 1.x database by deleting orphaned records from database tables which cause foreign key contraint failures. This happens when at some point in time records where deleted from the database while FOREIGN_KEY_CHECKS = 0 and the person performing the delete operations failed to delete all related records pertaining to related tables of the primary table.

This script can be helpful when encountering foreign key constraint failures using the Data Migration Tool to migrate your

@diazwatson
diazwatson / ask.sh
Created July 22, 2016 00:02
Bash: General-purpose Yes/No prompt function ("ask")
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
ask() {
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then
prompt="Y/n"
@diazwatson
diazwatson / blockchain ID
Created July 13, 2016 00:03
blockchain ID
Verifying that +diazwatson is my blockchain ID. https://onename.com/diazwatson