This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this file to the root of your Craft CMS project dir | |
exclude = "{$exclude,web/{cpresources,media,transcoder,images/*},storage/{backups,config-backups,config-deltas,runtime,logs},*.sql,.ddev/.*}" | |
includeDirectories = "{$includeDirectories,.ddev}" | |
excludeDirectories = "{$excludeDirectories,.ddev/*}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Allow 'require-ing' at least one option from a list of checkboxes | |
// with the same name. Polyfill for modifying the default HTML behaviour | |
// which is requiring all checkboxes with the 'required' attribute | |
// | |
// eg: | |
// <input type=checkbox name=eg value=a data-required-any> | |
// <input type=checkbox name=eg value=b data-required-any> | |
// <input type=checkbox name=eg value=c data-required-any> | |
(function (window) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# WARNING: This is not a complete NGINX configuration file | |
# It tries to highlight just the directives used to enable FastCGI microcaching | |
# as explained in my “Micro-caching in Nginx for High Performance” talk | |
# https://speakerdeck.com/rungta/micro-caching-in-nginx-for-high-performance | |
# Video: https://youtu.be/termdb4vepA?t=2199 | |
# | |
http { | |
#... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Uncheck any `input[type=checkbox]` (`[data-checkboxscope-input]`) | |
// outside a defined scope area (`[data-checkboxscope-container]`) | |
// | |
// Eg: | |
// | |
// <div data-checkboxscope-container> | |
// <input data-checkboxscope-input type=checkbox> | |
// </div> | |
// <div> | |
// <!-- a click here will uncheck the checkbox above --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# _init.twig #} | |
{# | |
Usage | |
extend `_init` | |
set `doNotCache` to true to exclude a page | |
set `cacheKey` to a string to cache a template globally | |
(as opposed to by URL). eg: 404 template | |
modify `cacheKeyPrefix` to include variation params, if any | |
#} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(w) { | |
function checkboxAsRadio(selector) { | |
return function (event) { | |
var el = event.target; | |
// only proceed if we have a matching checkbox | |
if (!(el instanceof HTMLInputElement && el.matches(selector))) { | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Open all external links in a new window | |
*/ | |
(function ($) { | |
function openExternalLinksInNewWindows() { | |
$('a') | |
.filter('[href^="http"], [href^="//"]') | |
.not('[href*="' + window.location.host + '"]') | |
.attr('rel', function (i, val) { | |
return 'noopener noreferrer ' + (val || ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://css-tricks.com/snippets/jquery/smooth-scrolling/ | |
// modified to use native scrollIntoView when supported | |
// Select all links with hashes | |
$('html').on('click', 'a[href*="#"]', function(event) { | |
// On-page links | |
if ( | |
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && | |
location.hostname == this.hostname | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is for ServerPilot configurations | |
# and should be located at /etc/apache-sp/vhosts.d/<APPNAME>.d | |
# See: https://gist.github.com/rungta/fd7edc3940ca9279b2095fb961466b8d | |
<Directory ${DOCUMENT_ROOT}> | |
# Disable .htaccess files | |
AllowOverride None | |
# Include root/.htaccess file | |
# the last character is a glob so that it silently ignores missing file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage | |
# imageoptim.sh /path/to/images/dir | |
# | |
# See: https://gist.github.com/rungta/0cc3f68beee42008e5cf05b2aa526954 | |
# Find image files modified in the last 24 hours |
NewerOlder