Skip to content

Instantly share code, notes, and snippets.

View cornobils's full-sized avatar

Dmitrijs Čornobiļs cornobils

View GitHub Profile
@cornobils
cornobils / AddToCartCommand.php
Created April 9, 2019 08:37
[Sylius] page with product choice form
<?php
declare(strict_types=1);
namespace App\Model;
use Sylius\Bundle\OrderBundle\Controller\AddToCartCommandInterface;
use Sylius\Component\Order\Model\OrderInterface;
use Sylius\Component\Order\Model\OrderItemInterface;
@cornobils
cornobils / InvoiceVoter.php
Created April 25, 2019 12:22
Adding link to invoice in Order completed email and making invoice available in public #Sylius #sylius/invoicing-plugin@0.8.3 #Symfony
<?php
declare(strict_types=1);
namespace App\Voter;
use Sylius\Component\Core\Repository\OrderRepositoryInterface;
use Sylius\InvoicingPlugin\Entity\InvoiceInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\Voter\Voter;
@cornobils
cornobils / webcryptoapi.js
Created April 4, 2020 22:35
window.crypto.encode/decode Javascript example
var secretmessage = "";
var password = "";
var key_object = null;
var promise_key = null;
var encrypted_data = null;
var encrypt_promise = null;
var vector = window.crypto.getRandomValues(new Uint8Array(16));
var decrypt_promise = null;
var decrypted_data = null;