Skip to content

Instantly share code, notes, and snippets.

View michelve's full-sized avatar
🌏
Rise and Reign

Michel michelve

🌏
Rise and Reign
View GitHub Profile
@michelve
michelve / change-attribute-type.php
Created December 22, 2018 15:36
Magento 2 - Update/Merge/Change Product Attributes
<?php
error_reporting(1);
ini_set('max_execution_time', 0);
use \Magento\Framework\App\Bootstrap;
require_once '/var/www/html/app/bootstrap.php';
$bootstrap = Bootstrap::create(BP, $_SERVER);
$objectManager = $bootstrap->getObjectManager();
@michelve
michelve / wp-odd-even-post.php
Last active June 18, 2018 14:22
create odd and even layout for wp post loop
<?php
$args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'category_name' => '',
'orderby' => 'date',
'order' => 'DESC',
'include' => '',
@michelve
michelve / find-products-without-images.sql
Last active December 22, 2018 15:31 — forked from tegansnyder/find-products-without-images.sql
Magento 2 - finding products without images - SQL
SELECT * FROM `catalog_product_entity` AS a
LEFT JOIN `catalog_product_entity_media_gallery` AS b ON a.entity_id = b.entity_id
WHERE b.value IS NULL
@michelve
michelve / https.conf
Created September 26, 2017 18:07
MacOS High Sierra - PilotKit fix
#
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure
@michelve
michelve / install.sh
Created July 12, 2017 21:22
Install phpmyadmin with PilotKit 3.5.0 +
#!/bin/bash
DIRECTORY="/Applications/PilotKit/Sites"
cd ${DIRECTORY}
#
if [ -d "$DIRECTORY" ]; then
echo 'removing existing directory phpmyadmin'
rm -rf ${DIRECTORY}/phpmyadmin
else
@michelve
michelve / install_xcode.sh
Created June 9, 2017 16:54 — forked from rtrouton/gist:f92f263414aaeb946e54
Install Xcode command line tools on 10.7.x - 10.10.x. Tested on 10.7.5, 10.8.5, 10.9.5 and 10.10.2.
#!/bin/bash
# Installing the Xcode command line tools on 10.7.x or higher
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}')
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress"
# Installing the latest Xcode command line tools on 10.9.x or higher
if [[ "$osx_vers" -ge 9 ]]; then
@michelve
michelve / permissions.sh
Last active June 9, 2017 14:27
Helps install dnsmasq, filezilla and mysql
#!/usr/bin/env bash
USER=$(logname)
osascript -e 'display notification "Fixing PilotKit files and core." with title "PilotKit"'
# fix scripts permissions
sudo chmod 777 /Applications/PilotKit/core/shell/repair/repair.sh
sudo chown -R "${USER}":admin /Applications/PilotKit
@michelve
michelve / osx_server_install.sh
Last active February 23, 2017 18:39
Install PHP and MySQL on OSX
#!/usr/bin/env bash
#install php:
##https://getgrav.org/blog/macos-sierra-apache-multiple-php-versions
#---------------
# bash <(curl -Ls https://git.io/vyeNE)
#PHP 7.1 (Current stable) - 10.10 and later
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.1
@michelve
michelve / add-to-cart-wc-variable-product.php
Created September 16, 2016 16:22
add variable product to cart woocommerce
<?php
// Get the WooCommerce Shop URL
$store_url = get_site_url();
// Action to perform: lets add product to cart
$action = "/?add-to-cart=";
// The product ID that we want to add.
$productID = "375";
@michelve
michelve / add_to_cart_ajax.html
Created September 14, 2016 12:41
AJAX add to cart - woocommerce
<a id="buy" href="#">Buy this!</a>
<script>
$('#buy').click(function(e) {
e.preventDefault();
addToCart(19);
return false;
});
function addToCart(p_id) {
$.get('/wp/?post_type=product&add-to-cart=' + p_id, function() {