This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copy and paste this into the browser console: https://github.com/<your-username>/<your-repo-name>/branches/stale | |
// Helper function | |
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms)); | |
async function clickDeleteElements() { | |
// Note: the label here may be different if you are not using English | |
const elements = Array.from(document.querySelectorAll('button[aria-label*=Delete]')); | |
for (let index = 0; index < elements.length; index++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Loads FontAwesome & assigns dashicon prefixed classes to correspond to FontAwesome fallbacks. | |
// This allows 'dashicons-' to be used when declaring custom post type icons. | |
function font_awesome_icons(){ ?> | |
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet"> | |
<style> | |
.dashicons-before:before { font-family: dashicons, FontAwesome; } | |
.dashicons-suitcase:before { content: "\f0f2"; } | |
.dashicons-cutlery:before { content: "\f0f5"; } | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
const BaseTable = { | |
props: { | |
fields: { | |
type: Array, | |
default: [], | |
validator(fields) { | |
return fields.find(field => field?.key === undefined || field?.label === undefined) === undefined | |
}, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// within AppServiceProvider::boot() or a similar entry point | |
Stringable::macro('markdownWithIframes', function ($config = []) { | |
$config['disallowed_raw_html'] = [ | |
'disallowed_tags' => ['title', 'textarea', 'style', 'xmp', 'noembed', 'noframes', 'script', 'plaintext'], | |
]; | |
$environment = new Environment($config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Hyper Volume", | |
"rules": [ | |
{ | |
"description": "Hyper + Up = Volume Up", | |
"manipulators": [ | |
{ | |
"from": { | |
"key_code": "up_arrow", | |
"modifiers": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('admin_head', function(){ | |
?> | |
<script type="text/javascript"> | |
/* | |
updated JS file for use with ACF >= 5.7.0 | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# Put this in your .zshrc | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
local node_version="$(nvm version)" | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -n "$nvmrc_path" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Essentially, the `onValueChanged` callback used to provide an object/array that was `===` during comparisons. | |
* In the last few days though, something changed and === was not working anymore. | |
* My solution is to serialize the values and compare those strings to ensure things are | |
not triggering unnecessary re-renders. | |
The external change handler is triggered even when the current editor updates the field value, | |
so we need to check it's equality to what is already in state, | |
otherwise the current editor will be in an endless loop of updating their own UI. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import PropTypes from 'prop-types'; | |
import ReactDOM from 'react-dom'; | |
import { TextInput } from '@contentful/forma-36-react-components'; | |
import { init } from 'contentful-ui-extensions-sdk'; | |
import '@contentful/forma-36-react-components/dist/styles.css'; | |
import './dist.css'; | |
import { createApolloFetch } from 'apollo-fetch'; | |
import { debounce, union, keyBy } from 'lodash-es'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Quick Edit Pro | |
* Plugin Author: Daron Spence | |
* Version: 0.1 | |
*/ | |
add_action( 'quick_edit_custom_box', function( $column_name, $post_type ){ | |
if ( 'post' === $post_type && 'post_excerpt' === $column_name ){ ?> |
NewerOlder