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 / Tax.php
Last active February 12, 2021 13:11
Refund magento creditmemos with highest tax
<?php
class Customer_RefundPartialCreditmemoWithTax_Model_Order_Creditmemo_Total_Tax
extends Mage_Sales_Model_Order_Creditmemo_Total_Tax
{
public function collect(Mage_Sales_Model_Order_Creditmemo $creditmemo)
{
$shippingTaxAmount = 0;
$baseShippingTaxAmount = 0;
$totalHiddenTax = 0;
@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) {