Skip to content

Instantly share code, notes, and snippets.

View bradystone's full-sized avatar

bstone bradystone

  • bstone
  • CA
View GitHub Profile
@bradystone
bradystone / php-code-inspection.md
Created October 22, 2017 08:48
How to install PHP code inspection tools using homebrew-php and how to integrate with JetBrain's IntelliJ or PhpStorm

#Inspection Tools with homebrew-php#

##Prerequisites##

  • Homebrew is installed

##Step 1: Installing homebrew-php##

  1. brew tap homebrew/dupes
  2. brew tap josegonzalez/homebrew-php
  3. brew install PHP53 (or other version of your choice)
@bradystone
bradystone / .eslintrc
Created August 10, 2017 07:52 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@bradystone
bradystone / default
Created July 5, 2017 05:54 — forked from dtomasi/default
Brew Nginx PHP7
server {
listen 80;
server_name localhost;
root /Users/YOUR_USERNAME/Sites;
access_log /Library/Logs/default.access.log main;
location / {
include /usr/local/etc/nginx/conf.d/php-fpm;
}
find . -type f -exec chmod 644 {} \; // 644 permission for files
find . -type d -exec chmod 755 {} \; // 755 permission for directory
find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
@bradystone
bradystone / magento2_eav_attribute_reference.md
Created January 20, 2017 09:16 — forked from ericrisler/magento2_eav_attribute_reference.md
References related to EAV Attribtues in Magento 2

The array of data you can pass to the \Magento\Eav\Setup\EavSetup::addAttribute() method is as follows:

$data = [
     'group' => 'General', // Name ofgroup in product admin page to place attribtue
     'type' => 'varchar',  // database storeage type (varchar|int|text|decimal)
     'sort_order' => 1000,
     'backend' => '',      // backend_model: class name used to retrieve/save the attribute data to the db
     'frontend' => '',     // frontend_model: ????
     'label' => 'UPC',     // frontend_label: the label text
<?php
use Magento\Framework\App\Bootstrap;
include('app/bootstrap.php');
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
$state = $objectManager->get('Magento\Framework\App\State');
$state->setAreaCode('frontend');
@bradystone
bradystone / magento2-cookies.MD
Created January 20, 2017 09:14 — forked from mborodov/magento2-cookies.MD
Magento 2 Cookies

Sample work with Cookie in Magento 2

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$cookieManager = $objectManager->get('Magento\Framework\Stdlib\CookieManagerInterface');

// set cookie value
$cookieManager->setPublicCookie('key', 'value');

//get cookie value
@bradystone
bradystone / M2 acl.xml
Created January 20, 2017 09:13 — forked from Vinai/M2 acl.xml
My current Magento 2 PHPStorm File Templates (Feb 2016)
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
</resource>
</resources>
</acl>
</config>
setup
-----
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento setup:di:compile
module
------
php bin/magento module:status
php bin/magento module:enable Kahanit_TableRateShipping
@bradystone
bradystone / Magento2-remove-orders-customers
Created January 20, 2017 09:12 — forked from carlowens/Magento2-remove-orders-customers
Magento 2 remove test data of orders and customers
SET FOREIGN_KEY_CHECKS = 0;
#clear orders
TRUNCATE TABLE `gift_message`;
TRUNCATE TABLE `quote`;
TRUNCATE TABLE `quote_address`;
TRUNCATE TABLE `quote_address_item`;
TRUNCATE TABLE `quote_id_mask`;
TRUNCATE TABLE `quote_item`;
TRUNCATE TABLE `quote_item_option`;
TRUNCATE TABLE `quote_payment`;