Skip to content

Instantly share code, notes, and snippets.

View imshuffling's full-sized avatar
🏠
Working from home

David Riches imshuffling

🏠
Working from home
View GitHub Profile
@imshuffling
imshuffling / 00-Readme.md
Created March 23, 2021 15:05 — forked from grncdr/00-Readme.md
Delete unused assets

Delete unused assets

This is an example script for deleting assets that aren't linked in your content model. It does this by walking through all assets and checking for any links back to them.

WARNING: This script does not take into account assets that are only linked inside of Text fields. If you primarily embed images directly using the markdown editor, this will very likely delete assets you depend on.

You must fill in your own CMA access token & space ID at the top before running

Usage

const plugins = [
"hyper-oceans16",
"hyper-statusline",
"hyper-tabs-enhanced",
"hyperborder",
"hypercwd",
"hyperterm-paste",
"hyperlinks",
"hyperterm-cursor",
"hyper-search",
@imshuffling
imshuffling / index.js
Created December 2, 2020 15:02
ContentModules
import React from 'react'
import PropTypes from 'prop-types'
import BlockTextLeft from './blocktextleft';
import BlockTextArea from './blocktextarea';
import BlockImage from './blockimage';
import BlockTwoColumn from './blocktwocolumn';
const MODULE_MAP = {
ContentfulTextLeft: BlockTextLeft,
@imshuffling
imshuffling / jquery-focus-maxlenth.js
Created January 24, 2019 15:01
jQuery, focus() to next input field, based on input maxlength attribute
$(document).ready(function(){
$(".giftcardCodeChecker .numbers input").on('input', function () {
if($(this).val().length == $(this).attr('maxlength')) {
$(this).next().focus();
}
});
});
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>