Skip to content

Instantly share code, notes, and snippets.

@faparicior
faparicior / .bashrc
Last active December 31, 2017 20:54
Show git branch on bash prompt
# Show git branch name
force_color_prompt=yes
color_prompt=yes
# Add git branch if its present to PS1
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\]$(parse_git_branch)\[\033[00m\]\$ '
else
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Jigsaw puzzle</title>
<script type="text/javascript">
function save(filename, data)
{
var blob = new Blob([data], {type: "text/csv"});
@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 \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
@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 / 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 / CheckBoxImgType.php
Last active October 28, 2022 13:24
Symfony2 checkbox button images using choice form
<?php
namespace CheckInBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;
class CheckBoxImgType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
@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
@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 / 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);