Skip to content

Instantly share code, notes, and snippets.

View romainnorberg's full-sized avatar
🏖️

Romain romainnorberg

🏖️
  • Freelance
  • World
View GitHub Profile
@localheinz
localheinz / actual-events.md
Last active October 30, 2019 07:47
List of interesting events for the PHPUnit event sub-system

Actual Events

  • Application\Started (in Command::main())

  • Application\Configured (in Command::handleArguments())

  • Bootstrap\Finished (in Command::handleBootstrap())

  • TestSuite\Loaded (in BaseTestRunner::getTest())

  • TestSuite\Configured (in TestRunner::doRun(), after handleConfiguration())

  • TestSuite\Sorted (in TestRunner::doRun())

  • Extension\Loaded (in TestRunner::doRun())

@Seldaek
Seldaek / ext-requires.txt
Last active February 15, 2020 18:52
PHP Extension Requirements on Packagist.org
Taken from packagist.org
Packages with a master branch update since June 1st 2018: 98977
Of those, package having requires on PHP extensions: 11676 (11.79%)
As only ~12% of packages declare their extension requirements,
and even then it might not be a complete list, take all this with
a big grain of salt, it is informative but definitely not a
complete picture of the most used extensions.
@andreasonny83
andreasonny83 / README.md
Created July 20, 2019 13:07
Run node app in background

Run node app in background

Running a script in the background in linux can be done using nohup, using nohup we can run node application in the background

$ nohup node server.js > /dev/null 2>&1 &
  • nohup means: Do not terminate this process even when the stty is cut off
  • > /dev/null means: stdout goes to /dev/null (which is a dummy device that does not record any output)
@theodorejb
theodorejb / convert_array_access_braces.php
Last active March 27, 2024 18:22
Migrate deprecated curly brace array access syntax to bracket syntax. Requires PHP 7.4.
<?php
error_reporting(E_ALL);
$opts = getopt('f:d:rb:', ['ext:', 'php:', 'diff::']);
if ((int)isset($opts['d']) + (int)isset($opts['f']) !== 1) {
$self = basename(__FILE__);
echo <<<EOF
Usage:
php $self -f<php_script> [-b] [--php <path_to_php>] [ --diff [<file>]]
@florentdestremau
florentdestremau / NewPasswordType.php
Last active March 10, 2023 13:17
A simple User authentication setup to copy & paste into your Symfony 3.4 install
<?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\PasswordType;
use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\FormBuilderInterface;
// Webpack
config.resolve = config.resolve || {};
config.resolve.alias = config.resolve.alias || {};
Object.assign(config.resolve.alias, {
jquery: path.join(__dirname, '/client/assets/lib/jquery/jquery.js'),
jqueryGritter: path.join(__dirname, '/client/assets/lib/jquery.gritter/js/jquery.gritter.js'),
perfectScrollbar: path.join(__dirname, '/client/assets/lib/perfect-scrollbar/js/perfect-scrollbar.jquery.min.js'),
@dvdbng
dvdbng / vim-heroku.sh
Last active April 22, 2024 22:42
Run vim in heroku updated 2017
mkdir ~/vim
cd ~/vim
# Staically linked vim version compiled from https://github.com/ericpruitt/static-vim
# Compiled on Jul 20 2017
curl 'https://s3.amazonaws.com/bengoa/vim-static.tar.gz' | tar -xz
export VIMRUNTIME="$HOME/vim/runtime"
export PATH="$HOME/vim:$PATH"
cd -
@nienkedekker
nienkedekker / phpstorm-cs-fixer.md
Last active February 2, 2024 03:09
Set up PHP-CS-Fixer in PHPStorm

Use PHP-CS-Fixer in PHPStorm

  • Install PHP-CS-Fixer on your local machine according to these instructions: https://github.com/FriendsOfPHP/PHP-CS-Fixer
  • Open PHPStorm, Preferences > Tools > External Tools and enter these values: img
  • Program, edit to match your path where PHP-CS-Fixer lives: /.composer/vendor/friendsofphp/php-cs-fixer/php-cs-fixer
  • Parameters: --rules=@PSR2 --verbose fix $FileDir$/$FileName$. Note that previous verions of PHP-CS-Fixer used --levels instead of --rules.
  • Working directory: $ProjectFileDir$

Click OK and Apply. Now we'll set up a shortcut.

  • Go to Preferences > Keymap and search for "PHP Fixer" (or whatever name you gave it). Add whatever shortcut you like, I'm using ctrl + cmd + ]:
@hewerthomn
hewerthomn / install_oci8_ubuntu_16.04_php7.1.md
Created February 22, 2017 14:45
How to install OCI8 on Ubuntu 16.04 and PHP 7.1
@azhararmar
azhararmar / Symfony - Manual User Authentication
Last active June 16, 2023 15:35
Manually Authenticate User In Symfony
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
// Manually authenticate user in controller
$token = new UsernamePasswordToken($user, null, 'main', $user->getRoles());
$this->get('security.token_storage')->setToken($token);
$this->get('session')->set('_security_main', serialize($token));