Skip to content

Instantly share code, notes, and snippets.

View w-jerome's full-sized avatar
💻
coding…

Jérôme Wohlschlegel w-jerome

💻
coding…
View GitHub Profile
@w-jerome
w-jerome / kill-docker.sh
Created January 15, 2025 17:24
Kill docker with terminal command
ps ax|grep -i docker|egrep -iv 'grep|com.docker.vmnetd'|awk '{print $1}'|xargs kill
@w-jerome
w-jerome / email-obfuscation.php
Created May 27, 2024 22:18
[PHP] Email Obfuscation (spam killer)
<?php
function emailObfuscation(string $email) {
return preg_replace_callback('/./', function($m) use ($email) {
return '&#' . ord($m[0]) . ';';
}, $email);
}
echo emailObfuscation('[email protected]');
@w-jerome
w-jerome / customer-by-group-and-country.sql
Created August 4, 2022 08:37
Prestashop — Export Customer with SQL
SELECT
c.id_customer,
c.firstname,
c.lastname,
c.email,
c.active,
c.newsletter,
c.optin,
c.date_add,
gl.name as social_title,
@w-jerome
w-jerome / directories.php
Created August 3, 2021 13:35
PHP - Get folders from path
<?php
$path = DIRECTORY_SEPARATOR . 'path' . DIRECTORY_SEPARATOR . 'folder';
$denies = array('..', '.');
$entries = array_diff(scandir($path), $denies);
foreach ($entries as $key => $file_or_folder) {
if (!is_dir($path . DIRECTORY_SEPARATOR . $file_or_folder)) {
unset($entries[$key]);
}
}
@w-jerome
w-jerome / html-module-js.html
Last active February 17, 2021 09:15
HTML/JS - Add javascript module in HTML
<script type="module">
// NOTE: You literally don't need a build process with preact.
import { h, Component, render } from 'https://unpkg.com/preact?module';
const app = h('h1', null, 'Hello World!');
render(app, document.body);
</script>
<script type="module">
// https://www.skypack.dev/
import confetti from 'https://cdn.skypack.dev/canvas-confetti';
@w-jerome
w-jerome / .htaccess
Created December 21, 2020 11:19
Apache - Https and www
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\.my-site\.com$ [NC]
RewriteRule ^(.*)$ https://www.my-site.com/$1 [L,R=301]
@w-jerome
w-jerome / .bash
Created November 9, 2020 15:37
WordPress CLI - Change lang
# Installer d'autres langues via wpcli
wp language core install fr_FR
# Changer de langue
wp site switch-language fr_FR
@w-jerome
w-jerome / .htaccess
Last active September 29, 2020 08:42
WordPress - Redirect image upload from local to prod
RewriteEngine On
RewriteBase /
RewriteRule ^(wp-content/uploads/.*) https://www.my-web-site.com/$1 [L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
@w-jerome
w-jerome / index.tpl
Last active January 20, 2020 09:39
Prestashop, Smarty - Translate string
{*
* Prestashop 1.6 Documentation
* http://doc.prestashop.com/display/PS16/Module+translation
* https://stackoverflow.com/questions/11340742/pass-a-variable-inside-translation-string-in-prestashop
*}
{* Translate Back-Office Key *}
{l s='This is translation' mod='my_module'}
{* Variables *}
@w-jerome
w-jerome / .htaccess
Created November 19, 2019 15:30
HTML - Boirplate maintenance
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule $ /maintenance.html [R=302,L]