Skip to content

Instantly share code, notes, and snippets.

View Schrank's full-sized avatar

Fabian Blechschmidt Schrank

View GitHub Profile
@Schrank
Schrank / DateTimeWithMicroseconds.php
Created January 29, 2022 07:54
Doctrine 2.11, Datetime and Microseconds
<?php
declare(strict_types=1);
namespace Winkelwagen\Dbal;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Types\ConversionException;
use Doctrine\DBAL\Types\Type;
@Schrank
Schrank / Dockerfile
Created June 15, 2021 11:26
Building gulp/npm with docker
FROM node:12-buster
MAINTAINER Fabian Blechschmidt
WORKDIR /opt
VOLUME ["/opt"]
CMD ["gulp", "default"]
@Schrank
Schrank / Dockerfile
Created March 17, 2021 13:40
This is a running docker container which can run MY (inherited) gulp setup I have no clue about
FROM node:12-buster
MAINTAINER Fabian Blechschmidt
WORKDIR /opt/magento/skin/frontend/rwd/theme
VOLUME ["/opt"]
CMD ["gulp", "default"]
@Schrank
Schrank / index.js
Created March 4, 2021 16:47
180days of entries and show unbillable with hourly rate 0
/*
Keep in mind that you can't use browser specific calls. Use following calls
--Loading httpContents--
loadURL(method,url,headers);
--Logging to the Console--
log(value);
--Base64--
@Schrank
Schrank / test.php
Created July 12, 2020 18:38
For some reason, the decryption doesn't work with this key - why?
<?php
spl_autoload_register(function ($className) {
$path = explode('\\', $className);
if (array_shift($path) == 'phpseclib') {
return require 'magento/lib/' . str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
}
});
use phpseclib\Crypt\Random;
@Schrank
Schrank / Untitled 1.csv
Created June 18, 2020 11:24
Export magento products as CSV from database (Build with Libre Office)
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 39 columns, instead of 27 in line 2.
"attribute_id","attribute_code","attribute_type",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
68,"cost","decimal","=CONCATENATE(B2;""_default.value AS "";B2;""_default,"";B2;""_store.value AS "";B2;""_store,"")","LEFT JOIN catalog_product_entity_","=C2"," AS ","=B2","_default ON ","=B2","_default",".store_id = 0 AND ","=B2","_default.entity_id =","p.entity_id AND ","=B2","_default.attribute_id = ","=A2"," LEFT JOIN catalog_product_entity_","=C2"," AS ","=B2",,"_store ON ","=B2","_store.","store_id = 1 AND ",,"=B2",,"_store.entity_id =","p.entity_id AND ",,,"=B2","_store.attribute_id = ","=A2",,"=TEXTJOIN("""";1;E2:AL2)"
64,"price","decimal","=CONCATENATE(B3;""_default.value AS "";B3;""_default,"";B3;""_store.value AS "";B3;""_store,"")","LEFT JOIN catalog_product_entity_","=C3"," AS ","=B3","_default ON ","=B3","_default",".store_id = 0 AND ","=B3","_default.entity_id =","p.entity_id AND ","=B3","_default.attribute_id = ","=A3"," LEFT JOIN catalog_product_entity_","=C3"," AS ","=B3",,"_store ON ","=B3","_store.",
@Schrank
Schrank / index.html
Created May 30, 2020 20:33
Get all Earthdawn dices for level 3-20
<!doctype html>
<html lang="de">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Earthdawn dices</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
@Schrank
Schrank / .env.local
Last active October 21, 2019 20:12
Smyfony4 Swift SMTP configuration for Uberspace
MAILER_PASSWORD=12345
/**
* Set prices and image configuration
*
* @param Varien_Event_Observer $observer
*/
public function salesQuoteCollectTotalsBefore(Varien_Event_Observer $observer)
{
/* @var $quote Mage_Sales_Model_Quote */
$quote = $observer->getQuote();
foreach ($quote->getAllItems() as $quoteItem) {
@Schrank
Schrank / matrixrate-php7.2.patch
Created February 28, 2018 05:37
Webshopapps Productmatrix PHP 7.2 compatible
Index: www/vendor/webshopapps/productmatrix/app/code/community/Webshopapps/Productmatrix/Model/Mysql4/Carrier/Productmatrix.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- www/vendor/webshopapps/productmatrix/app/code/community/Webshopapps/Productmatrix/Model/Mysql4/Carrier/Productmatrix.php (date 1519796135000)
+++ www/vendor/webshopapps/productmatrix/app/code/community/Webshopapps/Productmatrix/Model/Mysql4/Carrier/Productmatrix.php (date 1519796135000)
@@ -1715,7 +1715,7 @@
$weight = 0;
$qty = 0;