Skip to content

Instantly share code, notes, and snippets.

@kara-todd
kara-todd / Image.js
Created May 5, 2021 20:52
localFileResolver
import React from "react";
import _get from "lodash.get";
import GatsbyImage from "gatsby-image";
const fallbackUrl = "/fallback-image.svg";
const placeholderSVG = `data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cdefs/%3E%3Cpath fill='%23eee' d='M0 0h10v10H0z'/%3E%3C/svg%3E`;
const Image = ({ src, srcset, id, imageFile, sizes, ...props }) => {
const width = _get(props, "width");
const height = _get(props, "height");
@kara-todd
kara-todd / Image.js
Created December 4, 2020 05:50
Gatsby Image apollo client preview example
import React from "react";
import GatsbyImage from "gatsby-image";
const previewSVG = ({ width, height }) => `
<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}">
<rect fill="#eee" width="${width}" height="${height}"/>
</svg>
`;
const Image = ({ src, srcset, width, height, id, localFile, ...props }) => {
@kara-todd
kara-todd / ruleset.xml
Created November 14, 2018 03:27
WordPress Styleguide
<?xml version="1.0"?>
<ruleset name="AHY_WordPress">
<description>A custom set of rules to check for a WordPress project</description>
<exclude-pattern>/public/wp/*</exclude-pattern>
<exclude-pattern>*.twig</exclude-pattern>
<rule ref="Squiz.PHP.CommentedOutCode"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>