Skip to content

Instantly share code, notes, and snippets.

View ivanweiler's full-sized avatar
👾

Ivan Weiler ivanweiler

👾
View GitHub Profile
@ivanweiler
ivanweiler / sylius-api-examples.md
Last active April 4, 2018 12:37
Sylius API for React workshop

Select component in inspector and dump (in FF for example):

inspect(require('ko').contextFor($0));
inspect(require('ko').dataFor($0));

Get component from registry:

require('uiRegistry').get('componenet.name.in.layout')
#!/bin/bash
###
# Script for switching PHP versions
# Ivan Weiler
#
# Reference:
# http://robosparrow.github.io/2016/12/10/php-5-on-ubuntu16.html
# https://labbots.com/bash-script-to-switch-php-versions-in-ubuntu/
###
DROP PROCEDURE IF EXISTS ClearCoreUrlTable;
DELIMITER $$
CREATE PROCEDURE `ClearCoreUrlTable`()
BEGIN
SET @delete_counter = 0;
SET @table_name = 'core_url_rewrite';
SET @total_records = (SELECT count(*) FROM core_url_rewrite WHERE product_id is not null and category_id is not null);
WHILE @delete_counter < @total_records DO
SET @varSQL = CONCAT('DELETE FROM ', @table_name,' WHERE category_id IS NOT NULL and product_id IS NOT NULL AND is_system=0 LIMIT 500;');
<?php
/**
* Fast direct PHP port of https://github.com/github/version_sorter
* Not really tested
*/
class Strchunk
{
/**
* @var int
@ivanweiler
ivanweiler / woocommerce-complete-for-virtual-products.php
Last active December 27, 2025 08:57
woocommerce-complete-for-virtual-products-example.php
// add this to the bottom of your theme functions.php file
// wp-content/themes/{your_active_theme}/functions.php
add_filter( 'woocommerce_order_item_needs_processing', function ($virtual_downloadable_item, $product) {
if ( $product->is_virtual() ) { // or check if Gift Card for example by some criteria
return false;
}
return $virtual_downloadable_item;
}, 10, 2 );