Skip to content

Instantly share code, notes, and snippets.

View pgrimaud's full-sized avatar
:shipit:
BORED AS FUCK

Pierre Grimaud pgrimaud

:shipit:
BORED AS FUCK
View GitHub Profile
@pgrimaud
pgrimaud / phpstorm-autoformat.md
Last active January 24, 2019 21:23
Autoformat assignments and equals on PHP Storm

Autoformat code : Cmd + Alt + L

For equals :

Settings -> Editor -> Code Style -> PHP -> Wrapping and Braces -> Align consecutive assignments

This will replace

$toto = 'test';
@pgrimaud
pgrimaud / only_full_group_by.md
Last active August 24, 2017 12:46
FIxed : this is incompatible with sql_mode=only_full_group_by

Fix for vagrant:

mysql:
    install: '1'
    settings:
        version: '5.6'
        root_password: root
        override_options:
 mysqld:
@pgrimaud
pgrimaud / Iphonex.php
Created November 16, 2017 12:59
Automatically check iPhone X inventory in Apple Stores
<?php
/**
* https://www.apple.com/fr/ only
* For other languages, change uri of file_get_contents and change value of var $noStock
*/
$models = [
'iPhone X 64Go Silver' => 'MQAD2ZD/A',
'iPhone X 256Go Silver' => 'MQAG2ZD/A',
@pgrimaud
pgrimaud / no_memory_limit
Created June 7, 2018 12:42
Execute php command CLI without memory limit
php -d memory_limit=-1 test.php
@pgrimaud
pgrimaud / DockerFile Apache
Created January 6, 2019 18:10
apache/DockerFile
FROM httpd:latest
RUN echo 'LoadModule proxy_module modules/mod_proxy.so' >> /usr/local/apache2/conf/httpd.conf
RUN echo 'LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so' >> /usr/local/apache2/conf/httpd.conf
RUN echo 'Include conf/extra/httpd-vhosts.conf' >> /usr/local/apache2/conf/httpd.conf
@pgrimaud
pgrimaud / httpd-vhosts.conf
Last active January 8, 2019 10:41
config/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/usr/local/apache2/htdocs"
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://iim_php:9000/var/www/html/$1
</VirtualHost>
@pgrimaud
pgrimaud / index.php
Created January 6, 2019 18:21
index.php
<?php
echo 'Hello world';
@pgrimaud
pgrimaud / pdo.php
Created January 6, 2019 18:50
pdo.php
<?php
$pdo = new PDO('mysql:host=iim_mysql', 'root', 'root');
$databases = $pdo->query('SHOW DATABASES')->fetch(PDO::FETCH_ASSOC);
print_r($databases);
@pgrimaud
pgrimaud / karma.conf.js
Created January 9, 2019 00:16
karma.conf.js
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
@pgrimaud
pgrimaud / index.html.twig
Created January 14, 2019 01:53
index.html.twig
<!DOCTYPE html>
<html lang="en">
<head>
<title>Home</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--===============================================================================================-->
<link rel="icon" type="image/png" href="{{ asset('images/icons/favicon.png') }}"/>
<!--===============================================================================================-->
<link rel="stylesheet" type="text/css" href="{{ asset('vendor/bootstrap/css/bootstrap.min.css') }}">