Skip to content

Instantly share code, notes, and snippets.

View kandran's full-sized avatar

SAEZ Jonathan kandran

View GitHub Profile
@kandran
kandran / README.md
Last active August 29, 2015 14:03
PHP Storm Live Template

#PhpStorm Live Template

All my utils live template for phpstorm.

##Dump Value This live template is used for print a value according this type. So array and object are print by var_dump and primitive type with an echo. The END variable allow us to use a die if needed at the end of printing.

@kandran
kandran / gist:25cd8ca56427baa18283
Last active August 29, 2015 14:07
sql oracle exo conception
-- CREATE customer table
CREATE TABLE customer
( customer_id number(10) ,
name varchar2(50) not null,
date_naissance DATE,
date_creation DATE DEFAULT sysdate not null ,
CONSTRAINT customer_id_pk PRIMARY KEY (customer_id),
CONSTRAINT customer_u UNIQUE(name, date_naissance)
);
@kandran
kandran / Calculator_impl.cpp
Last active November 2, 2018 17:49
Corba is fun ! or not
#include <OB/CORBA.h>
#include "Calculator_impl.h"
//
// IDL:Calculator/memoire:1.0
//
::CORBA::Long Calculator_impl::memoire()
<?php
require_once("Ship.php");
class Accelerator extends Ship
{
protected $ship;
public function __construct(Ship $ship)
{
<?php
require_once('Document.php');
class ConfigDocument extends Document
{
}
@kandran
kandran / visitor.java
Last active August 29, 2015 14:18
Design pattern visitor en java (http://kandran.fr/design-pattern-visiteur)
interface IVisitable {
void accept(IVisitor visitor);
}
class Book implements IVisitable
{
public String support = "unknown";
public void accept(IVisitor visitor)
{
@kandran
kandran / README.md
Last active August 29, 2015 14:20
AdBlock detection

#AdBlock Detection

One way to detect AdBlock is to create a file named advert.js, set a var inside and in another script detect if this specific variable has been created. If not the advert.js file has not been load probably by adBlock.

<?php
require_once("ApplicationInterface.php");
class ApplicationA implements ApplicationInterface{
public function run()
{
echo "<br/> Application A start running";
//some computation
echo "<br/> Application A finished";
@kandran
kandran / README.md
Last active November 19, 2018 08:28
Use php-cs-fixer with phpstorm file watcher

Auto use php-cs-fixer at save with PHPStorm and file watcher

  1. Open settings ( ctrl + alt + s)
  2. Menu file watchers
  3. Import watchers.xml
  4. Change settings like path for php and php-cs-fixer
  5. Enjoy ! PSRize at save.

NB: File watchers are linked to a specific project, so we have to re-import them for each project. External tools have IDE scope but we couldn't run them automaticaly - we could set a key bind.

@kandran
kandran / teamspeaIptables.sh
Last active November 29, 2017 19:44
Iptables Rules for teamspeak
# Teamspeak Licence
iptables -t filter -A INPUT -p tcp --dport 2008 -j ACCEPT
iptables -t filter -A OUTPUT -p tcp --dport 2008 -j ACCEPT
# Teamspeak Voix par défaut
iptables -t filter -A INPUT -p udp --dport 9987 -j ACCEPT
iptables -t filter -A OUTPUT -p udp --dport 9987 -j ACCEPT
# Teamspeak ServerQuery
iptables -t filter -A INPUT -p tcp --dport 10011 -j ACCEPT