Skip to content

Instantly share code, notes, and snippets.

View atierant's full-sized avatar
👨‍💻
Man@Work

Arnaud Tiérant atierant

👨‍💻
Man@Work
View GitHub Profile
javascript:(function() {
var url = window.location.href;
var replacedUrl = url.replace('/current/', '/4.4/');
window.location.href = replacedUrl;
})();
@atierant
atierant / diff_dates.php
Created January 28, 2020 14:54
diff_dates.php
<?php
declare(strict_types=1);
$start = new DateTimeImmutable('2019-12-31'); // DateTime::createFromFormat('d/m/Y', '31/01/2019');
$end = new DateTimeImmutable('2020-02-02'); // DateTime::createFromFormat('d/m/Y', '02/02/2020');
foreach (new DatePeriod($start, DateInterval::createFromDateString('1 day'), $end) as $dt) {
echo $dt->format('d/m/Y').PHP_EOL;
}
<?php
add_event_handler('user_init', 'all_permissions_for_admin');
function all_permissions_for_admin()
{
global $user;
if (in_array($user['status'], array('admin', 'webmaster')))
{
$user['forbidden_categories'] = -1;
$user['image_access_list'] = -1;
@atierant
atierant / sync_piwigo.rb
Last active October 1, 2019 14:17
sync_piwigo
#https://linuxfr.org/users/saintgermain/journaux/partager-ses-photos-et-auto-hebergement
require 'mechanize'
require 'json'
require 'fileutils'
require 'pp'
#Variable
username = 'XXXXX'
password = 'XXXX'
@atierant
atierant / GroupConcat.md
Created May 28, 2019 13:45
GroupConcat

Complete support of GROUP_CONCAT in Doctrine2

Greetings all.

So developing that in the project over whom I now works, it were required to use function of GROUP_CONCAT (). Unfortunately, Doctrine2 «from a box» did not support this function. The available extension from Doctrine2 (Benjamin Eberlei) one of developers appeared as «limited support for GROUP_CONCAT». I understands that usage of the g function by the automatic machine put the project in dependence on MySQL, but to change a DBMS as gloves are not plan. So we will leave this question behind frames of a post.

As pogugliv I doing not find the ready decision, deciding to write him (ha t for a basis development of Benjamin'á). There are nothing to make comments there, therefore simply I represents it on court of the public:

@atierant
atierant / rxjs_operators_by_example.md
Created February 6, 2019 13:12 — forked from btroncone/rxjs_operators_by_example.md
RxJS 5 Operators By Example
@atierant
atierant / changement_telephone.md
Last active November 21, 2018 10:09
Achat nouveau téléphone

💲 Forfaits

Forfait mobile actuel SFR : 41 €
Estimation de ce forfait sur 24 mois : 41x24 = 984 €

SFR Changement de forfait seul

  • Power 50Go : 35/mois (eng 12m) (contre 20€/m pour tout nouvel abonnement)
    35x24 = 840 €
@atierant
atierant / array_count_insensitive.php
Created February 21, 2017 16:08
Case-insensitive version of array_count_values()
<?php
$array = ['J. Doe', 'J. Doe', 50, '50', 'J. Doe', 'j. doe', 'Show', 'SHOW', 'shoW', 'show', 'YOP'];
$array = array_count_values(array_map('strtolower', $array));
@atierant
atierant / git_submodules.md
Created January 6, 2017 14:04 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
#!/bin/sh
# Settings for a PHP Project
# Using:
# * PHP Lint
# *- PHP CS
# *- PHP Analyzer
# *- EmptyLines Checker
# *- Scrutinizer
# * PHPCPD