Skip to content

Instantly share code, notes, and snippets.

@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
div {
$colors: (
#c82639,
#ef8e00,
#9bbc1a,
#28649a,
);
$l: length($colors);
@each $color in $colors {
$i: index($colors, $color);
@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) {

Keybase proof

I hereby claim:

  • I am chrissi2812 on github.
  • I am flotschi (https://keybase.io/flotschi) on keybase.
  • I have a public key ASBdCyUXS8dqfwqpodWMIOrCAii6vdbdIkkTUTdmT6y7Iwo

To claim this, I am signing this object:

@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]
@Chrissi2812
Chrissi2812 / .htaccess
Created July 27, 2018 10:02
Remove WWW from Url
Rewritecond %{HTTP_HOST} !^{{ HOST }}
RewriteRule ^(.*)$ https://{{ HOST }}/$1 [R=301,L]
@Chrissi2812
Chrissi2812 / .htaccess
Last active July 27, 2018 10:10
Security Headers
<IfModule mod_headers.c>
# Disable malicious js in images
Header always set X-Content-Type-Options "nosniff"
# This forces https for all subdomains too!!
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
# Disallow iframing of website in other domains
Header always set X-Frame-Options "SAMEORIGIN"
# Protect Referrer
Header always set Referrer-Policy "no-referrer-when-downgrade, strict-origin-when-cross-origin"
@Chrissi2812
Chrissi2812 / pick.js
Created August 22, 2018 11:37
Pick attributes from Object
function pick(whiteListed, arr) {
return Object.entries(arr)
.filter(([key]) => whiteListed.includes(key))
.map(([key, value]) => ({ [key]: value }));
}
@Chrissi2812
Chrissi2812 / .htaccess
Created January 22, 2019 09:29
Sperrseite
##
# @package Joomla
# @copyright Copyright (C) 2005 - 2018 Open Source Matters. All rights reserved.
# @license GNU General Public License version 2 or later; see LICENSE.txt
##
##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line 'Options +FollowSymLinks' may cause problems with some server configurations.
@Chrissi2812
Chrissi2812 / grid_mixins.scss
Last active April 4, 2019 08:00 — forked from ksenzee/grid_mixins.scss
Mixins that make it possible to use CSS Grid in IE 10/11 as well as in modern browsers. Based on mixins by Sascha Fuchs at https://medium.com/@gisugosu/css-grid-layout-spec-2-to-spec-1-transpiler-with-sass-415dff4dd31b.
/// Add Gap between the boxes
///
/// @author Sascha Fuchs
///
/// @group core - cssgrid
///
/// @param {list} $boxes - List with box sizes
/// @param {string} $gap - Optional column gap
@function box-gap($boxes, $gap) {
$box: ();