Skip to content

Instantly share code, notes, and snippets.

View sdieunidou's full-sized avatar
🏠
Working from home

Seb sdieunidou

🏠
Working from home
View GitHub Profile
@sdieunidou
sdieunidou / .scrutinizer.yml
Created February 13, 2017 11:42
scrutinizer default configuration symfony3
filter:
excluded_paths:
- 'app/*'
- 'tests/*'
- 'bin/*'
- '*.min.js'
- 'web/assets/vendor/*'
- 'var/'
checks:
@sdieunidou
sdieunidou / terms-and-conditions-in-label.twig
Created February 10, 2017 13:55 — forked from marijn/terms-and-conditions-in-label.twig
This is how you add a link to a label with Symfony forms, sort of. Cause you'll have a label tag twice...
{% set terms_link %}<a title="{% trans %}Read the General Terms and Conditions{% endtrans %}" href="{{ path('get_general_terms_and_conditions') }}">{% trans %}General Terms and Conditions{% endtrans %}</a>{% endset %}
{% set general_terms_and_conditions %}{{ 'I have read and accept the %general_terms_and_conditions%.'|trans({ '%general_terms_and_conditions%': terms_link })|raw }}{% endset %}
<div>
{{ form_errors(form.acceptGeneralTermsAndConditions) }}
{{ form_widget(form.acceptGeneralTermsAndConditions) }}
<label for="{{ form.acceptGeneralTermsAndConditions.vars.id }}">{{ general_terms_and_conditions|raw }}</label>
</div>
nelmio_cors:
defaults:
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
@sdieunidou
sdieunidou / track_404.md
Last active November 2, 2015 15:54
Track 404 with GTM / GA

Track your 404 errors with Google Tag Manager and Symfony2.

Installation

TwigBundle/views/Exception/error404.html.twig

{% block javascripts %}
    {{ parent() }}
@sdieunidou
sdieunidou / rabbitmq.txt
Created October 22, 2015 19:51
create admin user on rabbitmq
rabbitmqctl add_user test test
rabbitmqctl set_user_tags test administrator
rabbitmqctl set_permissions -p / test ".*" ".*" ".*"
@sdieunidou
sdieunidou / 05-opcache.ini
Last active October 21, 2015 14:52
PHP 5.6+ opcache - settings for symfony2 app in production
# conf.d/05-opcache.ini
opcache.memory_consumption=1024
opcache.interned_strings_buffer=64
opcache.max_accelerated_files=20000
opcache.revalidate_freq=0
opcache.validate_timestamps=0
opcache.fast_shutdown=1
opcache.enable_cli=1
@sdieunidou
sdieunidou / capistrano3_php5-fpm_reload.md
Last active October 5, 2015 09:26
capistrano3_php5-fpm_reload

Task PHP5-reload for Capistrano3

tasks/php5.cap

namespace :php5 do
  desc 'Reload PHP5-FPM'
  task :reload do
      on release_roles :app do
 execute :sudo, "/usr/sbin/service php5-fpm", "reload"
<?php
// READ: https://mtxserv.com/forums/threads/api-game-viewer.295/
// Example usage of API Game Viewer (mtxserv.com)
$urlToken = 'https://mtxserv.com/oauth/v2/token?';
$urlViewer = 'https://mtxserv.com/api/v1/viewers/game?';
$query = array(
'grant_type' => 'https://mtxserv.com/grants/api_key',
'client_id' => '', // A Editer