This file contains hidden or 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
var testObj = {}; | |
testObj.name = "Larry"; | |
testObj.getName = function() { return testObj.name; } | |
// Outputs: function () { return testObj.name; } |
This file contains hidden or 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
// Returns first element that matches CSS selector {expr}. | |
// Querying can optionally be restricted to {container}’s descendants | |
function $(expr, container) { | |
return typeof expr === "string"? (container || document).querySelector(expr) : expr || null; | |
} | |
// Returns all elements that match CSS selector {expr} as an array. | |
// Querying can optionally be restricted to {container}’s descendants | |
function $$(expr, container) { | |
return [].slice.call((container || document).querySelectorAll(expr)); |
This file contains hidden or 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
// LazyLoad Library: https://github.com/aFarkas/lazysizes | |
// Usage | |
<sly data-sly-use.template="/path/to/template/image.html" | |
data-sly-call="${ template.imageMarkup @ xsvp=image.xsvpPath, svp=image.svpPath, mvp=image.mvpPath, lvp=image.lvpPath, altText=image.altText, lazyLoad=true }" /> | |
// HTL Template | |
<template data-sly-template.imageMarkup="${ @ xsvp, svp, mvp, lvp, altText, lazyLoad }"> | |
<picture> | |
<source media="(max-width: 480px)" data-srcset="${xsvp}" /> |
This file contains hidden or 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 loadScript(src, done) { | |
let js = document.createElement('script'); | |
js.src = src; | |
js.onload = function() { | |
done(); | |
}; | |
js.onerror = function() { | |
done(new Error('Failed to load script ' + src)); | |
}; | |
document.head.appendChild(js); |
This file contains hidden or 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 browserSupportsAllFeatures() { | |
// Your Polyfill needs go here | |
return window.Promise && window.fetch && window.Symbol; | |
} | |
function loadScript(src, done) { | |
let js = document.createElement('script'); | |
js.src = src; | |
js.onload = function() { | |
done(); |
This file contains hidden or 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
{ | |
"rules": { | |
"jsx-a11y/anchor-has-content": 1, | |
"jsx-a11y/aria-props": 1, | |
"jsx-a11y/aria-proptypes": 1, | |
"jsx-a11y/aria-role": 1, | |
"jsx-a11y/aria-unsupported-elements": 1, | |
"jsx-a11y/click-events-have-key-events": 1, | |
"jsx-a11y/heading-has-content": 1, | |
"jsx-a11y/href-no-hash": 1, |
This file contains hidden or 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
[ | |
{ | |
"title": "Stylish Family Apartment", | |
"tags": ["Interior"], | |
"image": "http://templates.thememodern.com/theratio/images/projects-grid/project1.jpg", | |
"url": "http://templates.thememodern.com/theratio/project.html" | |
}, | |
{ | |
"title": "Minimalist Guest House", | |
"tags": ["Decor","Interior"], |