Skip to content

Instantly share code, notes, and snippets.

@zaydek-old
zaydek-old / bookmark.min.js
Last active January 22, 2023 13:42
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@fldtrace
fldtrace / functions.php
Last active July 3, 2021 18:26
Better, Faster, Responsive Images for Divi – Upload in Divi child theme.
<?php
// enable divi functions
add_action( 'wp_enqueue_scripts', 'my_enqueue_assets' );
function my_enqueue_assets() {
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
}
//add 1440px image size
add_image_size('image_1440', 1440, 9999, false);
@sergejmueller
sergejmueller / index.html
Last active December 14, 2021 09:50
Embedded Google Analytics: Fix “Leverage Browser Caching” Warning on Nginx
<html>
<!-- ... -->
<!-- Embed analytics.js as local file -->
<script src="/analytics.js"></script>
</html>
@solancer
solancer / mod_pagespeed .htaccess
Last active January 11, 2023 07:25
mod_pagespeed .htaccess configuration
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
@occupant
occupant / THEMENAME.theme
Last active August 15, 2020 18:32
Add active class to active 'li' in Drupal 8 menus
function THEMENAME_preprocess_menu(&$variables, $hook) {
if ($hook == 'menu_main') {
THEMENAME_menu_active_item($variables['items']);
}
}
function THEMENAME_menu_active_item(&$items) {
$current_path = \Drupal::request()->getRequestUri();
foreach ($items as $key => $item) {
// if path is current path, set active to li
@hans2103
hans2103 / .htaccess-mod_headers
Created April 13, 2015 08:33
.htaccess rules to set cache control.
<IfModule mod_headers.c>
Header set Connection keep-alive
# Cache-control headers
# 2 HOURS
#<filesMatch "*">
Header set Cache-Control "max-age=7200, must-revalidate"
#</filesMatch>
# 480 weeks - 290304000
@mhayes
mhayes / README.md
Last active December 20, 2015 13:48
Using jQuery noConflict mode

Enabling noConflict mode

Using a default Foundation 5 download you'll see some code like this in your index.html file:

<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/foundation/js/foundation.min.js"></script>
<script src="js/app.js"></script>