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