Skip to content

Instantly share code, notes, and snippets.

@faparicior
faparicior / workshop-value-object-or-not-quiz-5.php
Created March 25, 2024 09:27
workshop-value-object-or-not-quiz-5
readonly class Money
{
private function __construct(private string $amount, private Currency $currency)
{}
public static function eur(string $amount): self
{
return new static($amount, Currency::eur());
}
@faparicior
faparicior / workshop-value-object-or-not-quiz-4.php
Created March 21, 2024 18:53
workshop-value-object-or-not-quiz-4
final class Money
{
public function __construct(private string $amount, private Currency $currency)
{}
public function amount(): string
{
return $this->amount;
}
@faparicior
faparicior / workshop-value-object-or-not-quiz-3.php
Created March 21, 2024 18:52
workshop-value-object-or-not-quiz-3
final class Money
{
private string $amount;
private string $currency;
public function __construct(private string $amount, private string $currency)
{
if (!is_numeric($amount)) {
throw new InvalidAmountException::notNumeric($amount);
}
@faparicior
faparicior / workshop-value-object-or-not-quiz-2.php
Created March 21, 2024 18:50
workshop-value-object-or-not-quiz-2
final class Money
{
public function __construct(private string $amount, private string $currency)
{
if (!is_numeric($amount)) {
throw new InvalidAmountException::notNumeric($amount);
}
if (!in_array(strtoupper($currency), ['EUR', 'USD'])) {
throw new InvalidCurrencyException::notInTheAcceptedCurrencies($currency);
@faparicior
faparicior / workshop-value-object-or-not-quiz-1.php
Last active March 21, 2024 18:42
workshop-value-object-or-not-quiz-php-1
final class Money
{
public function __construct(private string $amount, private string $currency)
{
if (!is_numeric($amount)) {
throw new InvalidAmountException::notNumeric($amount);
}
$this->amount = $amount;
$this->currency = $currency;
@faparicior
faparicior / fix-slow-starting-after-remove-swap-partition.md
Last active January 26, 2022 15:17
fix slow starting after remove swap partition
  • remove /etc/initramfs-tools/conf.d/resume

  • sudo update-initramfs -u

  • alternatively you can Interrupt GRUB by pressing any key, then press E to edit the currently-selected boot entry, find the line starting with the word linux and add noresume as a separate word to the end of that line. This is only for test purposes. Tha changes are not persisted.

@faparicior
faparicior / Diagrams.net Event storming color scheme
Last active March 7, 2022 10:20
Draw.io event storming colour scheme
{
"customColorSchemes": [
[
{
"fill": "#ffcc00",
"stroke": "none"
},
{
"fill": "#ccffff",
"stroke": "none"
@faparicior
faparicior / Dockerfile
Created April 30, 2020 19:49 — forked from sophiaphillipa/Dockerfile
Configuring PHPStorm to work with xDebug and Docker, by listening.
FROM php:7-fpm
RUN apt-get update && \
apt-get install -y \
zlib1g-dev \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng12-dev
@faparicior
faparicior / README.md
Created April 28, 2020 19:00 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&& echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@faparicior
faparicior / end.gcode
Created April 28, 2020 16:03
Start and End G-code for Ender 3 on Cura
; Ender 3 Custom End G-code
G4 ; Wait
M220 S100 ; Reset Speed factor override percentage to default (100%)
M221 S100 ; Reset Extrude factor override percentage to default (100%)
G91 ; Set coordinates to relative
G1 F1800 E-3 ; Retract filament 3 mm to prevent oozing
G1 F3000 Z20 ; Move Z Axis up 20 mm to allow filament ooze freely
G90 ; Set coordinates to absolute
G1 X0 Y{machine_depth} F1000 ; Move Heat Bed to the front for easy print removal
M106 S0 ; Turn off cooling fan