Skip to content

Instantly share code, notes, and snippets.

View kandran's full-sized avatar

SAEZ Jonathan kandran

View GitHub Profile
<link rel="import" href="myComponentToImport.html" />
var template = document.querySelector('#helloWord');
var clone = document.importNode(template.content, true);
var host = document.querySelector('#container');
host.appendChild(clone);
<template id="helloWord">
<style>
h1{
color: green;
}
</style>
<div>
<h1>Hello Word</h1>
<h2>...</h2>
</div>
@kandran
kandran / xpath-cheatseet.md
Last active August 29, 2015 14:24
XPath Cheatsheet
@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
@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.

<?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 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.

@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)
{
<?php
require_once('Document.php');
class ConfigDocument extends Document
{
}