Skip to content

Instantly share code, notes, and snippets.


Alexander Deider vpArth

View GitHub Profile
vpArth / TicTacToe.php
Created Aug 24, 2018
TicTacToe implementation (variable map size, win condition, players set)
View TicTacToe.php
class TicTacToeGame
/** @var int */
private $width;
/** @var int */
private $height;
/** @var int */
private $winCond;
vpArth / AjaxAuthenticationListener.php
Created Nov 30, 2016 — forked from xanf/AjaxAuthenticationListener.php
AJAX auth errors listener for Symfony2
View AjaxAuthenticationListener.php
namespace Application\ProdrepHelperBundle\Component\Event;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
class AjaxAuthenticationListener
vpArth /
Last active Jul 14, 2016
Ansible modules
import os.path
import re
from subprocess import call
module: php5mod
short_description: Wraps php5enmod/php5dismod functionality
vpArth /
Created Dec 7, 2015 — forked from naholyr/
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.


Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
View piano.js
var TEMP = 210; // bpm
function tap(note, part, next) {, 1, MPP.client.getOwnParticipant(), 0);
MPP.piano.stop(note, MPP.client.getOwnParticipant(), 0);
}, 60e3/(TEMP*part)*4);
vpArth / Symfony2 +
Created Sep 15, 2015 — forked from tjamps/
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
View Symfony2 +

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g.

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

View SigManager.cpp
#include <map>
#include <iostream>
#include <signal.h>
#include <unistd.h>
class Strategy
virtual void use(void) = 0;
View commenting.vimrc
" Toggle comment line
" Ctrl+/
let s:comment_map = {
\ "c": '//',
\ "cpp": '//',
\ "go": '//',
\ "java": '//',
\ "javascript": '//',
\ "php": '//',
vpArth / 0_reuse_code.js
Created Jun 20, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.