Skip to content

Instantly share code, notes, and snippets.

View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Next: Chrome",
View useSmoothScroll.js
import {
useRef, useCallback, useEffect, useState
} from 'react';
import smoothscroll from 'smoothscroll-polyfill';
smoothscroll.polyfill();
function useSmoothScroll() {
const scrollRafPending = useRef(false);
const scrollRafInstance = useRef(false);
@j2is
j2is / img.twig
Created Jan 22, 2019
Macro for responsive images
View img.twig
{###
# macros for responsive images
#
# https://straightupcraft.com/articles/responsive-images-with-twig-macros
# https://nystudio107.com/blog/creating-optimized-images-in-craft-cms
#
# usage simple: {{ macro_img.responsive(asset) }}
# usage extra: {{ macro_img.responsive(assetThumbnail, {alt: 'some thumb', class: ['thumb-class'], {style: 'thumb'}}) }}
#}