Skip to content

Instantly share code, notes, and snippets.

View tlacroix's full-sized avatar

Tommy Lacroix tlacroix

View GitHub Profile
@tlacroix
tlacroix / check-webp-support.js
Created March 18, 2021 17:31
WebP detection support
/**
* This script detects WebP support, and adds a "nowebp" class to the body element
* if support is not present.
*
* It uses two detections:
* 1) The first quick and synchroneous one checks if the browser
* can encode a canvas into a WebP Data URL. It returns true right away on Chrome.
* 2) The second longer and asynchroneous one checks if the browser
* can decode a lossy image WebP Data URL. It returns true on all browsers that
* actually support WebP.
@tlacroix
tlacroix / httpd-vhosts
Created July 8, 2020 18:42
Basic Log Rotation Configuration for Apache Virtual Hosts Logs - /etc/logrotate.d/
/var/www/*/logs/*.log {
size 10M
missingok
notifempty
sharedscripts
delaycompress
postrotate
/sbin/service reload httpd
endscript
}
@tlacroix
tlacroix / nginx.conf
Last active July 9, 2020 12:46
Basic WordPress configuration for nginx
user www-data;
worker_processes auto;
pid /run/nginx.pid;
events {
worker_processes auto;
worker_connections 1024; # ulimit -n
multi_accept on;
use epoll;
}