Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Sébastien SERRE sebastienserre

🏠
Working from home
View GitHub Profile
View gist:fcf4dbd667512c094e76466f4550470d
sebastien@sebastien-desktop:~$ ssh -vv defr9012@delaware.o2switch.net
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /home/sebastien/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: resolving "delaware.o2switch.net" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to delaware.o2switch.net [109.234.162.115] port 22.
debug1: Connection established.
debug1: identity file /home/sebastien/.ssh/id_rsa type 0
View get_lat_lng()
function get_lat_lng( $address ) {
$address = rawurlencode( $address );
$coord = get_transient( 'geocode_' . $address );
if( empty( $coord ) ) {
$url = 'http://nominatim.openstreetmap.org/?format=json&addressdetails=1&q=' . $address . '&format=json&limit=1';
$json = wp_remote_get( $url );
if ( 200 === (int) wp_remote_retrieve_response_code( $json ) ) {
$body = wp_remote_retrieve_body( $json );
$json = json_decode( $body, true );
}
View gist:c75eb40cf0d881aa5ba33afb2568c829
This file has been truncated, but you can view the full file.
Attaching to stjean_database_1
database_1 | chmod: changing permissions of '/helpers/add-cert.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/auth.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/binding.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/generate-key.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/get-remote-url.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/lando-entrypoint.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/load-keys.sh': Operation not permitted
database_1 | chmod: changing permissions of '/helpers/mounter.sh': Operation not permitted
@sebastienserre
sebastienserre / add-sitemaps.php
Created Oct 26, 2018
Example of code to add a dynamic url for sitemaps in WP multisite / Multidomain
View add-sitemaps.php
add_filter( 'robots_txt', 'thfo_add_sitemaps');
function thfo_add_sitemaps( $output ){
$sitemap_url = 'sitemap: ' . get_bloginfo('url') . '/sitemap.xml';
$output .= $sitemap_url;
return $output;
}
View gist:40e29534508fdc90bfa34de0596e4484
public function compare_register_prod() {
error_log( 'start Import' );
//$truncat = $wpdb->query( 'DELETE FROM ' . $table . ' WHERE `platform` LIKE "Awin"' );
$partners = $this->awin['partner'];
$partners = explode( ',', $partners );
$secondes = apply_filters( 'compare_time_limit', 600 );
View disable-gutenberg-callout.php
<?php
/*
Plugin Name: Disable Gutenberg Callout
Plugin URI: https://www.thivinfo.com
Description: Disable the Gutenberg Callout added in WordPress 4.9.8
Author: Sébastien SERRE
Author URI: https://thivinfo.com
Version: 1.0.0
*/
/*
@sebastienserre
sebastienserre / gist:f9f42b947cb05391bf08ae20a64b8f51
Last active Mar 22, 2018
Correct date format before importing with WP ALL Import
View gist:f9f42b947cb05391bf08ae20a64b8f51
/**
* correct Date in XML from Pericles fr-> en
*/
function thfo_correct_date($biens) {
$date = explode( '/', $biens->DATE_MODIF );
$date = $date[2] . '/' . $date[1] . '/' . $date[0];
$date = date( 'Y/m/d', strtotime( $date ) );
@sebastienserre
sebastienserre / extract_zip.php
Created Mar 20, 2018
This Gist unzip file before import by the WordPress Plugin WP ALL Import
View extract_zip.php
<?php
/**
* Unzip photo before import by WP ALL Import
*/
function thfo_extract_photo(){
$path = wp_get_upload_dir();
$file = $path['basedir'] . '/wpallimport/files/export.ZIP';
$real_path = $path['basedir'] . '/wpallimport/files/';
@sebastienserre
sebastienserre / functions.php
Created Dec 27, 2015
Snippet for WP functions.php
View functions.php
<?php
// add a favicon
function favicon_link() {
echo '<link rel="shortcut icon" type="image/x-icon" href="http://www.thivinfo.com/wp-content/themes/thivinfo_v3/favicon.ico" />' . "\n";
}
add_action( 'wp_head', 'favicon_link' );