Skip to content

Instantly share code, notes, and snippets.

@sorcamarian
sorcamarian / ImageLoader-examples.js
Created August 3, 2022 14:37 — forked from foleyatwork/ImageLoader-examples.js
How to run Squarespace's ImageLoader manually.
// 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.
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()
@sorcamarian
sorcamarian / Node.js File Looper
Created March 26, 2019 13:24 — forked from adamwdraper/Node.js File Looper
Loop through all files in a given directory with node.js
var fs = require('fs');
var walkPath = './';
var walk = function (dir, done) {
fs.readdir(dir, function (error, list) {
if (error) {
return done(error);
}