Skip to content

Instantly share code, notes, and snippets.

View pierreboissinot's full-sized avatar

Pierre Boissinot pierreboissinot

View GitHub Profile
used for onename check.
@pierreboissinot
pierreboissinot / watchers.xml
Created January 1, 2018 16:57
PhpStorm FileWatcher for php-cs-fixer
<TaskOptions>
<TaskOptions>
<option name="arguments" value="--verbose fix" />
<option name="checkSyntaxErrors" value="true" />
<option name="description" />
<option name="exitCodeBehavior" value="ALWAYS" />
<option name="fileExtension" value="php" />
<option name="immediateSync" value="false" />
<option name="name" value="php-cs-fixer" />
<option name="output" value="" />

VIM TIPS

  • Map CAPS LOCK key to ESC cuz' key is closer and prevent me from yelling. how to do this
@pierreboissinot
pierreboissinot / pstorm-sf-translation.md
Last active January 7, 2018 15:51
PhpStorm Symfony Translation Flow

PhpStorm Symfony Translation Flow

Basic Requirements

  • Symfony's translation service is enabled and configured doc
  • Translastion resources/files are createddoc

PhpStorm Configuration

First, go to File > Settings > Languages & Frameworks > PHP > Symfony.

  • Check that the Symfony Plugin is enabled for the project.
  • Check that the Translation Root Path settings is corrected, something like src/AppBundle/Resources/translations.
-- when the database/ORM try to insert a record with an existing id/PK
ALTER SEQUENCE sequence_name RESTART WITH your_next_free_id;
@pierreboissinot
pierreboissinot / weather curl.sh
Created July 9, 2018 09:49
get the weather with curl
# today
curl wttr.in/~Nantes?0
# this week
curl wttr.in/~Nantes
@pierreboissinot
pierreboissinot / Developing composer package.txt
Last active October 30, 2021 06:32
Developing composer package
* Be sure to set minimum-stability to dev
* Use options symlink true
* When requiring a package via path repository, there is no git related features (like requiring the package on a specific branch). The symlink use filesystem.
@pierreboissinot
pierreboissinot / missing-translation.sh
Created November 23, 2018 11:03
Check missing translation in symfony project with translation component
#!/usr/bin/env bash
IFS=',' read -r -a locales <<< "$1"
bundle=$2
echo "Check missing translation for locales $locales in $bundle"
for locale in $locales ; do
if ./bin/console debug:translation $locale $bundle | grep missing
then
(>&2 echo "Translations are missing for locale $locale")
exit 1
else
@pierreboissinot
pierreboissinot / lokalise_symfony.md
Created November 27, 2018 10:16
How to manage translation in a Symfony project with Lokalise ?

Use case: Translations in YAML

  1. Sign in with email/password (Live edit JS does not support SSO)
  2. Create project
  3. Import translations files with the correct language
  4. Connect Gitlab integration (Add Web category - required for exporting with MR & check include full path nin file name)
  5. Configure auto pull
  6. Export project with following settings
  • Format: YAML
@pierreboissinot
pierreboissinot / PhoneNumbeProvider.php
Created February 7, 2019 14:36
PhoneNumber Faker Provider
<?php
// AliceBundle: https://github.com/hautelook/AliceBundle/blob/master/doc/faker-providers.md
// https://github.com/misd-service-development/phone-number-bundle/issues/27
// Usage: <PhoneNumber()>
namespace App\DataFixtures\Faker\Provider;
use Faker\Factory;
use libphonenumber\PhoneNumberUtil;
class PhoneNumberProvider