Skip to content

Instantly share code, notes, and snippets.

@julienbourdeau
julienbourdeau / clean-prestashop-db.sql
Last active March 20, 2024 13:06
Clean PrestaShop database - Drop old and unless data
# Delete all logs
TRUNCATE ps_log;
# Delete old connection data (only used for stats)
# change 2016-02-01 00:00:00 according to you needs
DELETE c, cs
FROM ps_connections c
LEFT JOIN ps_connections_source cs ON (c.id_connections = cs.id_connections)
WHERE c.date_add < '2016-02-01 00:00:00';
@spolischook
spolischook / kotoblog_parse-http-accept-language-header.php
Last active November 15, 2023 04:35
Get prefer language by parsing HTTP_ACCEPT_LANGUAGE header
<?php
$prefLocales = array_reduce(
explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']),
function ($res, $el) {
list($l, $q) = array_merge(explode(';q=', $el), [1]);
$res[$l] = (float) $q;
return $res;
}, []);
arsort($prefLocales);
@endersonmaia
endersonmaia / dynamic-vhosts.conf
Created June 22, 2012 15:01
Apache Dynamic VHosts, PHP and Pow on Mac OS X
#
# Use this file to make all directories in /Users/enderson/Sites/ available via localtest.me
#
# Example:
#
# www.example.com.localtest.me --> /Users/enderson/Sites/www.example.com
# a.www.example.com.localtest.me --> /Users/enderson/Sites/a.www.example.com
# example.com.localtest.me --> /Users/enderson/Sites/example.com
#
# Change enderson to fit your username.