Skip to content

Instantly share code, notes, and snippets.

View alexcarpenter's full-sized avatar
:shipit:

Alex Carpenter alexcarpenter

:shipit:
View GitHub Profile
@alexcarpenter
alexcarpenter / MarkdownPage.tsx
Created February 17, 2021 14:05 — forked from jaredpalmer/MarkdownPage.tsx
Get headers from MDX in Next.js
import {MDXProvider} from '@mdx-js/react';
import {MDXComponents} from 'components/MDX/MDXComponents';
import {Toc} from 'components/Toc/Toc';
import * as React from 'react';
export interface MarkdownProps<Frontmatter> {
meta: Frontmatter;
children?: React.ReactNode;
}
@alexcarpenter
alexcarpenter / _lazyFocusImager.twig
Created June 29, 2018 20:31 — forked from sjelfull/_lazyFocusImager.twig
Twig/Craft macro for lazy responsive images/bgimages with Imager and Focuspoint
{#
// lazyLoaded Image/bgImages, optimized with Imager and Focuspoint
---------------------------------------------------------------------------
https://nystudio107.com/blog/creating-optimized-images-in-craft-cms
https://github.com/aelvan/Imager-Craft
https://github.com/smcyr/Craft-FocusPoint
for the bgImage intrinsic ratio classname creation check:
https://github.com/inuitcss/inuitcss/blob/develop/objects/_objects.ratio.scss
@alexcarpenter
alexcarpenter / index.html
Created September 27, 2017 12:23 — forked from shelldandy/typekit.html
Master Race Typekit Solution by Glen Maddern
<head>
<script>
if (window.localStorage && window.localStorage._tk_cache) {
document.documentElement.classList.add('wf-active');
var script = document.createElement('script');
script.innerHTML = localStorage._tk_cache + ";(function () {var timeout = setTimeout(function () {document.documentElement.classList.remove('wf-active');}, 300); Typekit.load({ async: false, active: function () { clearTimeout(timeout); }});})();";
document.head.appendChild(script);
}
window._tk_onload = function () {
var req = new XMLHttpRequest()
import qs from 'qs';
import Axios from 'axios';
Axios.defaults.baseURL = Craft.baseUrl;
Axios.defaults.headers.common['Accept'] = 'application/json';
Axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
Axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded';
Axios.interceptors.request.use(config => {
if (config.data === Object(config.data)) {
@alexcarpenter
alexcarpenter / img.html
Created December 9, 2016 20:00 — forked from brettburwell/img.html
Craft macro to centralize the markup and config for responsive images
{# ================================================================== #}
{# ================================================================== #}
{# Responsive Images
{# ================================================================== #}
{# ================================================================== #}
{#
{% import '_macros/img' as macroImg %}
Macro to centralize the markup and config for responsive images.
@alexcarpenter
alexcarpenter / functional-utils.js
Created October 5, 2016 20:43 — forked from bendc/functional-utils.js
A set of pure and immutable ES2015 functions aimed to make functional JavaScript more idiomatic.
// array utils
// =================================================================================================
const combine = (...arrays) => [].concat(...arrays);
const compact = arr => arr.filter(Boolean);
const contains = (() => Array.prototype.includes
? (arr, value) => arr.includes(value)
: (arr, value) => arr.some(el => el === value)
@alexcarpenter
alexcarpenter / command.sh
Created February 25, 2016 16:50 — forked from sponomarev/command.sh
Remove iTerm2 icon from Dock
# remove
/usr/libexec/PlistBuddy -c 'Add :LSUIElement bool true' /Applications/iTerm.app/Contents/Info.plist
# restore
/usr/libexec/PlistBuddy -c 'Delete :LSUIElement' /Applications/iTerm.app/Contents/Info.plist