Skip to content

Instantly share code, notes, and snippets.

View kellymears's full-sized avatar

Kelly Mears kellymears

View GitHub Profile
const fs = require(`fs-extra`)
const request = require(`request`)
const path = require(`path`)
const config = require(`./../gatsby-config`)
module.exports = async ({ actions, graphql }) => {
const GET_MEDIA_ITEMS = `
query GET_MEDIA_ITEMS($first: Int) {
wpgraphql {
mediaItems(first: $first) {
<?php
namespace App\Composers;
use Roots\Acorn\View\Composer;
use \App\Models\Post;
class PostContent extends Composer
{
@kellymears
kellymears / geoFeaturesFromCollection.js
Created July 2, 2019 19:01
geoJSON features from a geoJSON collection
const fs = require('fs')
const geo = require('./data')
const legit = ({properties: {postal}}) =>
postal && postal.length > 0
geo.features.forEach(feature => {
const op = legit(feature) && {
fileName: `./${feature.properties.postal}.geo.json`,
data: JSON.stringify({
<?php
namespace App\Composers;
use Roots\Acorn\View\Composer;
use \App\Models\Post;
class RelatedPodcasts extends Composer
{
<InnerBlocks
allowedBlocks={ALLOWED_BLOCKS}
renderAppender={() => (
<div className="flex justify-center">
<button className="button button-primary button-large center mx-auto" onClick={() => this.setState({popover: true})}>
Insert glossary item
</button>
{this.state.popover && (
<Popover
position='bottom'
@kellymears
kellymears / recursive-array-to-collection-macro.php
Created June 14, 2019 06:58
recursive-array-to-collection-macro.php
<?php
\Illuminate\Support\Collection::macro('recursive', function () {
return $this->map(function ($value) {
if (is_array($value) || is_object($value)) {
return collect($value)->recursive();
}
return $value;
});
<?php
/**
* Plugin Name: Tiny Blocks
* Description: Backbone for modular block building
* Version: 0.1.0
* Author: Kelly Mears, Tiny Pixel
* Author URI: https://tinypixel.dev
* License: MIT
* Text Domain: tinyblocks
*
module.exports = {
prefix: '',
important: false,
separator: ':',
theme: {
screens: {},
colors: {},
spacing: {},
backgroundColor: {},
backgroundPosition: {},
@kellymears
kellymears / BackgroundPanel.js
Created May 23, 2019 00:12
Pretty Good Banner Block
// @wordpress
import { __ } from '@wordpress/i18n'
import { Fragment } from '@wordpress/element'
import { PanelBody, RangeControl } from '@wordpress/components'
import { MediaUpload } from '@wordpress/editor'
// components
import { FocalPointTool } from './../tools/FocalPointTool'
const BackgroundPanel = props => (