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
<squarespace:query collection="{collection.urlId}" category="{collection.categories}" tag="{collection.tags}" limit="3"> | |
{.section items} | |
<section class="f-featured-posts"> | |
<h3>Featured Posts</h3> | |
<ul class="f-featured-list"> | |
{.repeated section @} | |
<li class="f-featured-item">{title}</li> | |
{.end} | |
</ul> |
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
YUI().use('node', 'anim', function (Y) { | |
Y.on('domready', function () { | |
(function () { | |
Y.one('body').delegate('click', function (e) { | |
e.preventDefault(); | |
var anchor = e.currentTarget.getAttribute('href'); | |
var scrollAnim = new Y.Anim({ | |
node: Y.one(Y.UA.gecko || Y.UA.ie || !!navigator.userAgent.match(/Trident.*rv.11\./) ? 'html' : 'body'), | |
to: { | |
scrollTop : Y.one(anchor).getY() |
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 () { | |
var css = '.disable-hover, .disable-hover * { pointer-events: none !important; }', | |
head = document.head || document.getElementsByTagName('head')[0], | |
style = document.createElement('style'), | |
body = document.body, | |
timer; | |
style.type = 'text/css'; | |
if (style.styleSheet){ | |
style.styleSheet.cssText = css; |
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
// For all images. | |
var allImages = document.querySelectorAll('img[data-src]'); | |
for (var i = 0; i < allImages.length; i++) { | |
ImageLoader.load(allImages[i]); | |
} | |
// For a single image. |
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
/** | |
* Creates a grid with static gutters. | |
* | |
* @mixin grid--static-gutter | |
* @param {Number} columns The number of columns in your grid. | |
* @param {Number} gutter Gutters, set in pixels regardless of any unit passed. | |
*/ | |
.grid--static-gutter(@columns: 2, @gutter) { | |
@width: 100 / @columns; | |
@marginRight: @gutter * (@columns - 1) / @columns; |
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
/** | |
* This variable gets added to "window" and becomes | |
* the global namespace for your site. | |
* | |
* @namespace Site | |
* @global | |
*/ | |
var Site = {}; |
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
/** | |
* This controller pattern relies on a createController method that | |
* I typically create in my site.js. To see a boilerplate site.js file | |
* that works with this style, see the link below. | |
* | |
* @see https://gist.github.com/foleyatwork/f2a67d4a28f43a55d1cd | |
*/ | |
Site.createController('RefreshImagesOnResize', function() { | |
// When using jQuery inside of a controller, just assume the |
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
/* | |
* This way of creating a controller has a few issue: | |
* 1. It buries the namespace declaration at the bottom of the document. | |
* 2. It creates an unnecessary abstraction of the namespace that may not be obvious to developers. | |
* 3. It requires retyping the namespace in every single file. | |
*/ | |
(function(exports) { | |
var HelloWorld = function() { | |
console.log('Hello, World!'); | |
} |
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
// YUI | |
if (Y.one('.some-el')) { | |
// returns undefined if .some-el is not on the page. | |
} | |
// jQuery (incorrect) | |
if ($('.some-el')) { | |
// returns an array if .some-el is not on the page. | |
} |
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
/* globals Ok, _, ReactDOM, ENV, Mousetrap */ | |
const OkModalManager = require("~/okmodal/util/OkModalManager"); | |
const App = require("~/okmodal/components/App"); | |
const C = require("~/okmodal/util/Constants"); | |
/** | |
* Log an error string to the console with a styling OkModal prefix. | |
* @method logSimpleError | |
* @param {String} message |
OlderNewer