Skip to content

Instantly share code, notes, and snippets.

View cornobils's full-sized avatar

Dmitrijs Čornobiļs cornobils

View GitHub Profile
@jmsalcido
jmsalcido / load_poetry_docker_compose_into_pycharm.md
Last active April 17, 2024 16:51
Load correctly poetry environment from docker compose into pycharm available environments

PyCharm and Poetry with Docker (Compose)

I use PyCharm for my python development and normally I use a virtual env but now I found poetry and it manages the dependencies in a better way than just having a pip requirements file.

I had issues loading correctly a poetry environment from docker compose into pycharm available environments.

This sometimes works, sometimes I just reload the entire environment.

Step 1:

Run your docker image of course.

@migmolrod
migmolrod / UriPrefixVoter.php
Last active June 28, 2019 08:47
UriPrefixVoter for Sylius backend
<?php
// File: <project>/src/Voter/UriPrefixVoter.php
namespace App\Voter;
use Knp\Menu\ItemInterface;
use Knp\Menu\Matcher\Voter\VoterInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
@hoekstramenno
hoekstramenno / BookingByYearSequenceGenerator.php
Last active April 9, 2019 08:52
BookingNumber By Year Generator. Creates unique incremental invoice numbers ; inspired by Sylius
<?php
namespace App\BookingNumbers;
use App\Interfaces\BookingNumberGeneratorInterface;
use App\Interfaces\BookingNumberSequenceInterface;
/**
* Generates an unique Booking number with the format <current year>0000
* The sequence is divided by year in the order_sequence table and incremented with each order
@diogocapela
diogocapela / moment-js-timezones.txt
Created September 7, 2018 00:10
List of All Moment.js Timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Asmera
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
@jesperveldhuizen
jesperveldhuizen / Dropdown.php
Last active January 26, 2019 09:36
Sulu custom dropdown content ty-e
<?php
namespace AppBundle\Sulu\Content\Type;
use Sulu\Component\Content\Compat\PropertyInterface;
use Sulu\Component\Content\Compat\PropertyParameter;
use Sulu\Component\Content\SimpleContentType;
/**
* ContentType for a dropdown and selecting one option.
@matti
matti / add.sh
Created July 29, 2017 11:12
alpine docker add package from edge testing
apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
x11vnc
@nicanaca0
nicanaca0 / ImportProductsCommand.php
Last active May 1, 2024 11:05
Simple CSV Product importer for Sylius. Includes the product, the variant, channel pricing, taxons images and associations (1.0.0-beta.2)
<?php
namespace AppBundle\Command;
use Sylius\Component\Core\Model\ChannelPricingInterface;
use Sylius\Component\Core\Model\ProductInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Sylius\Component\Product\Model\ProductAssociationInterface;
use Sylius\Component\Product\Model\ProductAssociationTypeInterface;
use Sylius\Component\Taxonomy\Model\TaxonInterface;
@sylvaincombes
sylvaincombes / config.yml
Last active March 30, 2018 08:51
Symfony Ivory CkEditor protect twig syntax protectedSource
ivory_ck_editor:
configs:
default:
# ...
# protect twig syntax
entities: false
protectedSource: ["/\{\{[\s\S]*?\}\}/g", "/\{\%%[\s\S]*?\%%\}/g", "/\{\#[\s\S]*?\#\}/g"]
# @see http://ckeditor.com/addon/showprotected for a plugin with a visual indicator / editor of protected source if needed
@ziadoz
ziadoz / install.sh
Last active April 20, 2024 10:18
Install Chrome, ChromeDriver and Selenium on Ubuntu 16.04
#!/usr/bin/env bash
# https://developers.supportbee.com/blog/setting-up-cucumber-to-run-with-Chrome-on-Linux/
# https://gist.github.com/curtismcmullan/7be1a8c1c841a9d8db2c
# https://stackoverflow.com/questions/10792403/how-do-i-get-chrome-working-with-selenium-using-php-webdriver
# https://stackoverflow.com/questions/26133486/how-to-specify-binary-path-for-remote-chromedriver-in-codeception
# https://stackoverflow.com/questions/40262682/how-to-run-selenium-3-x-with-chrome-driver-through-terminal
# https://askubuntu.com/questions/760085/how-do-you-install-google-chrome-on-ubuntu-16-04
# Versions
CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE`
@fntlnz
fntlnz / self-signed-certificate-with-custom-ca.md
Last active May 10, 2024 10:46
Self Signed Certificate with Custom Root CA

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096