Skip to content

Instantly share code, notes, and snippets.

View benfavre's full-sized avatar
💻
At the office

Webdesign29 benfavre

💻
At the office
View GitHub Profile
@benfavre
benfavre / leaflet-react.ts
Last active May 18, 2024 08:14
Leaflet react
import { LeafletProvider, createLeafletContext } from '@react-leaflet/core';
import { Map as LeafletMap, LatLngBoundsExpression, LatLngExpression, MapOptions, FitBoundsOptions } from 'leaflet';
import React, { useCallback, useEffect, useRef, useState } from 'react';
interface MapContainerProps extends MapOptions {
bounds?: LatLngBoundsExpression;
boundsOptions?: FitBoundsOptions;
center?: LatLngExpression;
children?: React.ReactNode;
className?: string;
@benfavre
benfavre / find-ovh-ftp-host.js
Created July 24, 2023 13:21
FIND OVH FTP HOST for given login, password
const ftp = require("basic-ftp")
let currentServer = 1;
const getHost = (number) => {
number = number.toString().padStart(3, '0');
let host = `ftp.cluster${number}.hosting.ovh.net`;
console.log('Host is :', host);
return host;
}
const connectFtp = async (number) => {
let client = new ftp.Client()
@benfavre
benfavre / README-axelor-install.TXT
Created May 29, 2023 23:27
axelor install from source
//https://forum.axelor.com/t/axelor-5-3-3-installation/2913/22
Axelor Ver 5.3.6 Installation in Ubuntu 18.0
Prerequisites
Git 9
OpenJDK 8 15
Tomcat 9.0.26 8
PostgreSQL version 10.12 8 or later
Install Git
Install Git 9
@benfavre
benfavre / filter.php
Created June 21, 2022 21:25
Remove featured image if it appears in "the_content" WordPress filter
```php<?php
add_filter( 'the_content', function ($content) {
$content = mb_convert_encoding($content, 'HTML-ENTITIES', "UTF-8");
$featured_image = get_the_post_thumbnail_url($post->ID);
$doc = new DOMDocument();
$doc->loadHTML($content, );
$imgs = $doc->getElementsByTagName('img');
for($i = $imgs->length; --$i >= 0;){
$node = $imgs->item($i);
@benfavre
benfavre / web-app-Library-Traits-HasTemplate.php
Last active April 11, 2022 14:24
Acelle mail - Fix email sending to outlook with IE conditional comments - Check for // FIX comments
<?php
namespace Acelle\Library\Traits;
use Acelle\Model\Template;
use Exception;
use Acelle\Library\ExtendedSwiftMessage;
use Acelle\Model\Setting;
use Acelle\Library\StringHelper;
use League\Pipeline\PipelineBuilder;
@benfavre
benfavre / gist:a4d39e7acca90a75d68474fbf611e43d
Created August 18, 2021 10:23
Backup : Dump / Restore databases in seperate files MySQL, mysqldump
# DUMP
mysql -N -e 'show databases' | while read dbname; do mysqldump --complete-insert --routines --triggers --single-transaction "$dbname" > "$dbname".sql; done
# IMPORT
for sql in *.sql; do dbname=${sql/\.sql/}; echo -n "Now importing $dbname ... "; mysql $dbname < $sql; echo " done."; done
## Credits https://ma.ttias.be/mysql-back-up-take-a-mysqldump-with-each-database-in-its-own-sql-file/
@benfavre
benfavre / gist:3545ff1ebbf8daf3f3ef19d388df5b00
Created August 4, 2021 09:03
Compress a PDF command line linux
gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile=out.compressed.pdf in.pdf;
wp xml import
Process started: 2021-05-26 13:09:52 +00:00
Found 74 files.
Progress: 1 % [=> ] 0:00 / 0:00Warning: No match for site with prefix : AEXE
Warning: No match for site with prefix : AEXE
Warning: No match for site with prefix : AEXE
Warning: No match for site with prefix : EF02
Warning: No match for site with prefix : EF02
Warning: No match for site with prefix : EF02
Warning: No match for site with prefix : EF02
@benfavre
benfavre / js
Created May 25, 2021 14:14
nginx conf proxy node
server {
server_name monssite.fr;
listen 80;
return 307 https://$host$request_uri;
}
server {
server_name monssite.fr;
listen 443 ssl http2; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
@benfavre
benfavre / php
Created May 25, 2021 14:09
Product
<?php
Array
(
[0] => Array
(
[libelle] => Array
(
[value] => les-plats
[label] => LES PLATS
)