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 / 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"
@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 / 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() }}
nelmio_cors:
defaults:
allow_credentials: false
allow_origin: []
allow_headers: []
allow_methods: []
expose_headers: []
max_age: 0
hosts: []
@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>
@sdieunidou
sdieunidou / symfony2-pull-requests.md
Created April 12, 2017 08:05 — forked from immutef/symfony2-pull-requests.md
HowTo: clean GitHub pull requests for Symfony2
  1. Fork Fabiens repository: http://github.com/fabpot/symfony.git

  2. Clone your fork and install/update vendors (I use my personal fork for now):

    git clone git@github.com:pminnieur/symfony.git symfony

    cd symfony && sh install_vendors.sh && sh update_vendors.sh

    phpunit

  3. Integrate Fabiens repository into your local clone:

@sdieunidou
sdieunidou / gist:7f4502ed2d8810e7a39317418c9adefb
Created August 9, 2018 13:30 — forked from httpdss/gist:948386
Mysql general log parser
#!/usr/bin/perl
use strict;
use Data::Dumper;
use Getopt::Long;
# author: Gavin Towey, 2008 gtowey@gmail.com
# todo, add "follow thread" capability
# so we can give a process name or thread id & see
# all activity in sequence for each thread
@sdieunidou
sdieunidou / Api.md
Last active September 7, 2018 11:22
Api.md

Initialiser une API Rest, avec la ressource /api/tweets. Les méthodes suivantes seront implémentés :

  • cget(): retourne la liste de tous les tweets
  • get($id): retourne un tweet par son ID
  • post(): création d'un Tweet
<?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
@sdieunidou
sdieunidou / hytale-api.js
Last active April 29, 2019 15:30
hytale-api.js
var HytaleApi = require('hytale-api-sdk');
var api = new HytaleApi.ArticlesApi();
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
console.log(data);
}