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 / gist:9ba894134f43123eaf5ff9a6d44f302a
Created August 13, 2018 14:01
MYSQL / MARIADB error | Can't init tc log
[Note] Recovering after a crash using tc.log
[ERROR] Can't init tc log
[ERROR] Aborting
FIX:
rm /var/lib/mysql/tc.log
Then:
sudo service mysql start
(function(window) {
'use strict';
function define_library() {
var Core = {};
var Modal = {
closeButton: null,
modal: null,
overlay: null,
defaults: {
(function (window) {
"use strict";
function define_library() {
var Core = {};
var Modal = { closeButton: null, modal: null, overlay: null, defaults: { className: "fade-and-drop", closeButton: true, content: "", width: "600px", height: "480px", overlay: true } };
var Form = { clickEvents: [] };
var Profiler = {};
var config = { devmode: false, debug: false };
Profiler.startTime = function () {
this._startTime = performance.now();
@benfavre
benfavre / yoast_seo_opengraph_change_image_size.php
Created May 13, 2020 22:35 — forked from amboutwe/yoast_seo_opengraph_change_image_size.php
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 24 2019 using Yoast SEO 11.2.1 on WordPress 5.2.1
*/
add_filter( 'wpseo_opengraph_image_size', 'yoast_seo_opengraph_change_image_size' );
function yoast_seo_opengraph_change_image_size( $string ) {
// wd-faq/assets/js/faq-main.js
jQuery(document).ready(function(){
setTimeout(() => init(), 0);
});
function initFaq(){
console.log('Faq booted');
}
{
"calculator_type": "weight",
"dimension": {
"pricing": {
"enabled": "no",
"label": "",
"unit": "cm",
"calculator": {
"enabled": "no"
},
@benfavre
benfavre / README.MD
Last active April 11, 2020 09:30
Optimize WordPress WooCommerce - Oxygen

NON standard dirty SET of custom modifications to optimize baseline load times on WordPress sites with WooCommerce

  1. Disable weird cart sessions init on API calls ( maybe_init_cart_session )
@benfavre
benfavre / gist:3c4b7b11d495fe2694058a3775cb2777
Created April 7, 2020 21:19
Pas de succès sur ubuntu avec ça
# Deps
sed -i "s|# deb-src|deb-src|" /etc/apt/sources.list
apt update
export DEPS=" \
build-essential zlib1g-dev libpcre3-dev unzip uuid-dev \
debhelper po-debconf libexpat-dev libgd-dev libgeoip-dev libhiredis-dev \
libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev libssl-dev libxslt1-dev quilt"
apt install -y $DEPS
# NXG Pagespeed
@benfavre
benfavre / default.vcl_PREFACE.md
Created March 13, 2020 01:28 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 3 minute (180 sec) cache time. You can safely increase this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done in the Joomla section). If your CMS provides a way to add these 2 requirements, then you can use this configuration to speed up your site or entire server. You can even exclude the domains you don't want to cach

@benfavre
benfavre / sftp-ubuntu.md
Created March 9, 2020 12:55 — forked from lymanlai/sftp-ubuntu.md
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h