Skip to content

Instantly share code, notes, and snippets.

View Nolwennig's full-sized avatar
🐘
Focusing

Nolwennig Nolwennig

🐘
Focusing
View GitHub Profile
@Nolwennig
Nolwennig / delete_wp_revisions.sql
Last active April 12, 2023 08:43
This query deletes all post revisions that were modified more than 30 days ago from the current date. Note that this query can potentially delete a large number of revisions, so be sure to back up your data before running it.
DELETE FROM wp_posts
WHERE post_type = 'revision'
AND post_modified < DATE_SUB(NOW(), INTERVAL 30 DAY);
@Nolwennig
Nolwennig / color_headings.js
Created February 14, 2023 14:13
color each h2-h6 from DOM with a dotted border
let headings = document.querySelectorAll('h2, h3, h4, h5, h6');
for (let i = 0; i < headings.length; i++) {
let heading = headings[i];
let level = parseInt(heading.tagName.charAt(1));
let color;
switch (level) {
case 2:
color = "red";
break;
case 3:
@Nolwennig
Nolwennig / xdebug_lastest_version.sh
Created July 1, 2022 15:21
Get lastest tags version number from Xdebug
git ls-remote --tags https://github.com/xdebug/xdebug.git | grep -vE 'refs/tags/XDEBUG|{}' | tail -n1 | cut -d'/' -f3
# todo
# Inspired from https://gist.github.com/Nolwennig/57156f68d2aab1931e863a029cbf5dc0
# commmand list all containers docker
docker ps -a
# command to shown docker active
docker ps
# diff beetween active and all containers
# with the diff result pipe to sed to retrieve only container id
# use container ids result feed docker rm command
@Nolwennig
Nolwennig / readme.md
Last active August 26, 2021 10:40
Magento adminhtml - Wysiwyg editor with microdata tagging support

Magento adminhtml

Editeur Wysiwyg supportant le balisage microdata

Actuellement comme éditeur de texte dans le back-office, nous avons :

  • Tiny mce 3.5.11 sur catalog
  • Redactor v10.1.2 dans le module mage_pleasure blog

Aucun des deux ne permets de saisir de manière simplifié du contenu microdata.

<!DOCTYPE html>
<html>
<body>
<h1>This is heading 1</h1>
<p>My first paragraph.</p>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
@Nolwennig
Nolwennig / OwebiaShippingHelper.php
Created April 21, 2021 10:47
non well formed numeric value
public static function parseSize($size)
{
$strSize = trim($size);
$last = strtolower($strSize[strlen($strSize)-1]);
$size = rtrim($strSize, $last);
switch ($last) {
case 'g': $size *= 1024;
case 'm': $size *= 1024;
case 'k': $size *= 1024;
}
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p {
font-family:monospace;
text-align: center;
font-size: 60px;
margin-top: 0px;
@Nolwennig
Nolwennig / heart_acsii.txt
Created June 9, 2020 15:59
heart ascii (stolen from google images)
..010...010
.01011.01100
0110111101110
1100110010101
.11100101101
...1110111
.....010
......1
@Nolwennig
Nolwennig / readme.md
Last active May 26, 2020 04:30
Debian 9 : Quick Fix jessie-backports/main 404 Not Found

For fix :

On Debian 9 : comment jessie-backports in /etc/apt/sources.list.d/backports.list or in /etc/apt/sources.list