Skip to content

Instantly share code, notes, and snippets.

@sergejmueller
sergejmueller / .htaccess
Last active February 3, 2016 08:01
Remove line breaks and tabs from HTML with mod_substitute Apache module. For Nginx: https://github.com/sergejmueller/sergejmueller.github.io/wiki/Nginx:-nginx_substitutions_filter
AddOutputFilter SUBSTITUTE html
Substitute "s/[\n\t]//i"
@sergejmueller
sergejmueller / nginx.conf
Last active August 18, 2022 08:44
Stop search engines from indexing .txt, .log, .xml, .css and .js files in Nginx
location ~* \.(txt|log|xml|css|js)$ {
add_header X-Robots-Tag noindex;
}
@sergejmueller
sergejmueller / .htaccess
Last active June 16, 2016 08:34
Stop search engines from indexing .txt, .log, .xml, .css and .js files in Apache
<FilesMatch "\.(txt|log|xml|css|js)$">
Header set X-Robots-Tag "noindex"
</FilesMatch>
@sergejmueller
sergejmueller / vat_rates.php
Last active February 7, 2021 13:59
List of EU Countries (ISO-3166-2) with equivalent VAT Rates
$vat_rates = array(
'AT' => 20, // Austria
'BE' => 21, // Belgium
'BG' => 20, // Bulgaria
'HR' => 25, // Croatia
'CY' => 19, // Cyprus
'CZ' => 21, // Czech Republic
'DK' => 25, // Denmark
'EE' => 20, // Estonia
'FI' => 24, // Finland
@sergejmueller
sergejmueller / gulpfile.js
Created November 24, 2014 13:19
Gulp file for a static website with SCSS, UnCSS, inline sources, HTML minify, Zopfli compress and multiple local web servers.
/* Load plugins */
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
watch = require('gulp-watch'),
jshint = require('gulp-jshint'),
notify = require('gulp-notify'),
uncss = require('gulp-uncss'),
zopfli = require("gulp-zopfli"),
connect = require('gulp-connect'),
minifyhtml = require('gulp-minify-html'),
@sergejmueller
sergejmueller / index.html
Created September 9, 2014 08:20
Prevent animation flickering on CSS3 Transitions/Transforms in Safari
<!DOCTYPE html>
<html>
<style>
html {
-webkit-font-smoothing: antialiased;
}
</style>
@sergejmueller
sergejmueller / gist:088dce028b6dd120a16e
Last active November 14, 2019 11:20
mozjpeg vs. libjpeg-turbo – Output File Size and Execution Time

Lossless and progressive optimization of multiple (random picked, less than 1 MB) JPEG images with mozjpeg 2.0 and libjpeg-turbo.

Original Size mozjpeg Size libjpeg-turbo Size mozjpeg Speed libjpeg-turbo Speed
621 KB 612 KB 615 KB 0.658 s 0.297 s
505 KB 475 KB 477 KB 0.481 s 0.204 s
391 KB 376 KB 385 KB 0.846 s 0.441 s
888 KB 780 KB 794 KB 0.786 s 0.346 s
700 KB 668 KB 670 KB 0.765 s 0.320 s
@sergejmueller
sergejmueller / fastcgi_cache
Last active August 29, 2015 14:05
Nginx-Caching für PHP-generierte Inhalte. Weitere Details: http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html
## DEFAULT
set $no_cache 0;
## RULES
if ( $request_uri ~ "/wp-" ) {
set $no_cache 1;
}
if ( $http_cookie ~ (wp-postpass|wordpress_logged_in|comment_author)_ ) {
set $no_cache 1;
@sergejmueller
sergejmueller / nginx.conf
Created July 11, 2014 09:15
Access-Control-Allow-Origin CORS configuration on Nginx
location ~* \.(eot|ttf|woff|woff2)$ {
add_header Access-Control-Allow-Origin *;
}
@sergejmueller
sergejmueller / nginx.conf
Last active May 10, 2018 18:16
OCSP stapling PEM file for RapidSSL certificates used on Nginx. Details: https://plus.google.com/+SergejMüller/posts/Vq1Hf1AZ2vY
...
ssl_stapling on;
ssl_stapling_verify on;
ssl_trusted_certificate /usr/share/ssl/cert/rapidssl.pem;