Skip to content

Instantly share code, notes, and snippets.

View toddprouty's full-sized avatar

Todd Prouty toddprouty

View GitHub Profile
@toddprouty
toddprouty / map-embed.twig
Created August 25, 2023 09:59
Responsive map embed inserted with a variable and styled with Tailwind
{# Map Embed #}
{# Twig is the templating language used in this example, but these Tailwind classes could be used with any platform where the `iframe` is inserted via a variable. Apply them to the parent element of the iframe. #}
<div class="[&>iframe]:aspect-[5/4] [&>iframe]:w-full [&>iframe]:h-auto">
{{ entry.mapEmbed|raw }}
</div>
@toddprouty
toddprouty / eager-load-elements.twig
Created June 24, 2022 21:50
Craft CMS: How to eager-load images and transforms nested in a Matrix field
{# eagerLoadElements() explained here: https://bit.ly/3taeKAV
TL;DR: eagerLoadElements() lets you use eager-loading syntax for stuff that’s tied
to entry already (i.e. stuff you don’t need to pull in via a query). #}
{% do craft.app.elements.eagerLoadElements(
className(entry),
[entry],
[
'heroImage',
['videoGrid.video:posterImage', {
withTransforms: ['wide1920', 'wide1280', 'wide768', 'wide640', 'wide384']
@toddprouty
toddprouty / field-manager.php
Created April 5, 2022 21:41
Field Manager plugin config file - Craft CMS
<?php
return [
// Global settings
'*' => [
'cpSectionEnabled' => false,
],
// Dev environment settings
'dev' => [
@toddprouty
toddprouty / social-links.twig
Last active February 21, 2022 17:29
Social links managed in SEOmatic (Craft CMS plugin)
@toddprouty
toddprouty / 2021-10-14-T1332.lighthouse.report.json
Created October 14, 2021 18:32
Syniverse Lighthouse Results: Insights / Desktop / Local -- Initial
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1513,
"credits": {
"axe-core": "4.2.3"
}
},
@toddprouty
toddprouty / 2021-10-14-T1330.lighthouse.report.json
Created October 14, 2021 18:30
Syniverse Lighthouse Results: Insights / Mobile / Local -- Initial
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1799.5,
"credits": {
"axe-core": "4.2.3"
}
},
@toddprouty
toddprouty / 2021-10-14-T1328.lighthouse.report.json
Created October 14, 2021 18:28
Syniverse Lighthouse Results: Insights / Desktop / Live -- Initial
This file has been truncated, but you can view the full file.
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1450,
"credits": {
"axe-core": "4.2.3"
}
@toddprouty
toddprouty / 2021-10-14-T1325.lighthouse.report.json
Created October 14, 2021 18:25
Syniverse Lighthouse Results: Insights / Mobile / Live -- Initial
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1537,
"credits": {
"axe-core": "4.2.3"
}
},
@toddprouty
toddprouty / 2021-10-14-T1318.lighthouse.report.json
Created October 14, 2021 18:18
Syniverse Lighthouse Results: Blog Post / Desktop / Live -- Initial
This file has been truncated, but you can view the full file.
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1514.5,
"credits": {
"axe-core": "4.2.3"
}
@toddprouty
toddprouty / 2021-10-14-T1314.lighthouse.report.json
Created October 14, 2021 18:15
Syniverse Lighthouse Results: Blog Post / Mobile / Live -- Initial
{
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4590.2 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.81 Safari/537.36",
"benchmarkIndex": 1424,
"credits": {
"axe-core": "4.2.3"
}
},