Skip to content

Instantly share code, notes, and snippets.

@ericheydrich
ericheydrich / settings.php
Last active December 14, 2023 09:00
Adding Security Headers in Drupal 8 settings.php
header('Strict-Transport-Security: max-age=31536000; includeSubDomains; preload');
header('X-XSS-Protection: 1; mode=block');
header("Content-Security-Policy: default-src 'self' https://cdnjs.cloudflare.com/; style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com/; object-src data: 'unsafe-eval'; img-src data: 'self' w3.org/svg/2000; font-src data: 'self';");
header('Referrer-Policy: no-referrer');
@ericheydrich
ericheydrich / editMultipleFieldValues.txt
Created September 19, 2017 17:31
Trick for changing multiple field values at once
paragraph_revision__field_...
paragraph__field_...
--> edit all Elements in both tables --> then clear cache
@ericheydrich
ericheydrich / blazy_override.css
Last active July 19, 2017 13:00
Override Blazy Loader in Drupal 8
/*Blazy*/
.media--loading {
padding: 50px 0;
}
.media--loading::before {
width: 32px;
height: 32px;
max-width: 32px;
background: url(../../images/favicons/favicon-32x32.png) no-repeat center center;
-webkit-animation: rotateplane 1.2s infinite ease-in-out;
@ericheydrich
ericheydrich / .htaccess
Created May 12, 2017 11:12
Enforce SSL in Drupal 8 using a redirect
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@ericheydrich
ericheydrich / CSS
Created April 28, 2017 08:42
Changing HTML Number Spinners (build by Artem @komarovdesign - https://codepen.io/komarovdesign/pen/PPRbgb)
.quantity {
position: relative;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button
{
-webkit-appearance: none;
margin: 0;
}
{{ dump(user.account.name|raw) }}
@ericheydrich
ericheydrich / settings.php
Created March 1, 2017 08:51
Remove ?itok from Drupal 7 Images
$conf['image_suppress_itok_output'] = TRUE;
$conf['image_allow_insecure_derivatives'] = TRUE;
@ericheydrich
ericheydrich / .htaccess
Last active September 11, 2023 12:20
Caching in .htaccess
# If php compression not enabled, enable php compression
php_value zlib.output_compression 1
php_value zlib.output_compression_level 6
# Caching und Komprimierung
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.( html|css|png|jpg|jpeg|ttf|js|xml|php|txt|woff|woff2|svg|webp)$
@ericheydrich
ericheydrich / social_icons.html
Created February 23, 2017 16:31
Social Media Icons Inline SVG
<!-- Thanks to codepen.io/brav0 for pointing out that AdBlock Plus blocks the old "social-icons" class: -->
<ul class="soc">
<li><a href="#" class="icon-1 8tracks" title="8tracks"><svg viewBox="0 0 512 512"><path d="M185.304 240.455c-47.581 0-86.09 38.586-86.104 86.165 0.012 47.596 38.522 86.182 86.104 86.182 47.54 0 85.997-38.588 86.019-86.182 0-24.309-0.005-30.236-0.005-30.236h-30.743c0 0 0 5.947 0 30.236 -0.028 15.331-6.179 29.058-16.201 39.12 -10.049 10.043-23.753 16.218-39.07 16.218 -15.333 0-29.021-6.179-39.097-16.218 -10.025-10.063-16.175-23.79-16.197-39.12 0.021-15.316 6.172-29.041 16.197-39.104 10.077-10.043 23.764-16.202 39.097-16.221 28.282 0 111.983 0 141.405 0 47.563 0 86.076-38.319 86.092-85.914 -0.016-47.613-38.527-86.164-86.092-86.18 -47.551 0.017-86.074 38.567-86.092 86.18 0 24.181-0.021 29.986-0.021 29.986h30.726c0 0 0-5.805 0-29.986 0.027-15.314 6.267-29.043 16.315-39.121 10.04-10.024 23.744-16.203 39.069-16.203 15.314 0 29.049 6.177 39.098 16.22 10.014 10.062 16.17 23.789 16.17 39.103 0
Cache
# Clear all caches.
drush cc all
# Clear menu cache.
drush cc menu
# Select cache bin for clearing.
drush cc