Skip to content

Instantly share code, notes, and snippets.

@Chrissi2812
Chrissi2812 / TextColor.scss
Created April 26, 2017 12:01
Sass Auto Text Color
//YIQ Implementation
@function yiq($color) {
$red : red($color);
$green: green($color);
$blue : blue($color);
@return (($red*.299)+($green*.587)+($blue*.114));
}
@function color-contrast($background, $dark:#000, $light:#fff) {
div {
$colors: (
#c82639,
#ef8e00,
#9bbc1a,
#28649a,
);
$l: length($colors);
@each $color in $colors {
$i: index($colors, $color);
@Chrissi2812
Chrissi2812 / .htaccess
Created March 20, 2017 12:00
static brotli and gzip(zofpli) resources
# Rules to correctly serve gzip compressed CSS and JS files.
# Requires both mod_rewrite and mod_headers to be enabled.
<IfModule mod_headers.c>
# Serve brotli compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} br
RewriteCond %{REQUEST_FILENAME}\.br -s
RewriteRule ^(.*)\.css $1\.css\.br [QSA]
# Serve gzip compressed CSS files if they exist and the client accepts gzip.
RewriteCond %{HTTP:Accept-encoding} gzip
@Chrissi2812
Chrissi2812 / .htaccess
Created December 20, 2016 13:14
HTTPS for Let's Encrpty
RewriteCond %{HTTPS} !on
RewriteCond %{REQUEST_URI} !^/.well-known/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]