Skip to content

Instantly share code, notes, and snippets.

View betweenbrain's full-sized avatar
🎯
Focusing

Matt Thomas betweenbrain

🎯
Focusing
View GitHub Profile
@betweenbrain
betweenbrain / vue-route-guard-apollo-query.js
Last active July 10, 2019 20:35
Vue Apollo query from within Vue router route guard
router.beforeEach((to, from, next) => {
function delay(time) {
return new Promise(resolve => {
setTimeout(function() {
resolve();
}, time);
});
}
setTimeout(async function() {
@betweenbrain
betweenbrain / wp-flash.php
Last active July 17, 2022 18:16
WordPress Flash Messaging
<?php
/**
* Triggers validation when a post is saved.
*/
add_action(
'save_post',
'validate_post',
10,
3
@betweenbrain
betweenbrain / fieldmanager-hooks.md
Created February 11, 2019 16:19
WordPress Fieldmanager Hooks

A non-authoritative, possibly incomplete list of hooks registered by Fieldmanager for WordPress v1.0.0.

  • fieldmanager_draggablepost_li_content
  • fm_element_markup_start: After starting the field, apply a filter to allow other plugins to append functionality.
  • fm_element_markup_end: Before closing the field, apply a filter to allow other plugins to append functionality.
  • fm_element_classes
  • fm_preload_alter_values: Alter values before rendering.
  • fm_process_index_value: Alter handling of an individual index value, which may make sense to change per field type.
  • fm_presave_alter_values: Alter or respond to all the values of a particular element.
  • fieldmanager_media_preview
{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36","hostUserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","benchmarkIndex":1150},"lighthouseVersion":"3.2.0","fetchTime":"2019-01-14T21:40:48.244Z","requestedUrl":"http://dev-with-matt.pantheonsite.io/vue-create-element/","finalUrl":"http://dev-with-matt.pantheonsite.io/vue-create-element/","runWarnings":[],"runtimeError":{"code":"NO_ERROR","message":""},"audits":{"is-on-https":{"id":"is-on-https","title":"Does not use HTTPS","description":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your
{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36","hostUserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","benchmarkIndex":1322},"lighthouseVersion":"3.2.0","fetchTime":"2019-01-14T22:15:21.320Z","requestedUrl":"http://dev-with-matt.pantheonsite.io/vue-jsx/","finalUrl":"http://dev-with-matt.pantheonsite.io/vue-jsx/","runWarnings":[],"runtimeError":{"code":"NO_ERROR","message":""},"audits":{"is-on-https":{"id":"is-on-https","title":"Does not use HTTPS","description":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and your users, a
{"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","environment":{"networkUserAgent":"Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5 Build/MRA58N) AppleWebKit/537.36(KHTML, like Gecko) Chrome/71.0.3559.0 Mobile Safari/537.36","hostUserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36","benchmarkIndex":1322},"lighthouseVersion":"3.2.0","fetchTime":"2019-01-14T22:32:33.466Z","requestedUrl":"http://dev-with-matt.pantheonsite.io/vue-template/","finalUrl":"http://dev-with-matt.pantheonsite.io/vue-template/","runWarnings":[],"runtimeError":{"code":"NO_ERROR","message":""},"audits":{"is-on-https":{"id":"is-on-https","title":"Does not use HTTPS","description":"All sites should be protected with HTTPS, even ones that don't handle sensitive data. HTTPS prevents intruders from tampering with or passively listening in on the communications between your app and you
@betweenbrain
betweenbrain / vue-watch.vue
Created November 16, 2018 16:36
Vue.js watch element by ref
<script>
import Foo from 'bar';
export default {
name: 'Slider',
mounted() {
this.$watch(
() => {
return this.$refs.baz.currentValue;
},
@betweenbrain
betweenbrain / VS-Code-Xdebug-Lando.md
Last active October 4, 2018 18:51
[WIP] VS Code, Lando and Xdebug w/ profiling
@betweenbrain
betweenbrain / wp-rest-plugin.md
Created June 18, 2018 18:11
WordPress plugin to capture REST API cookie header
<?php
/**
 * Plugin Name: Cookie Check
 * Plugin URI: http://guggenheim.org/
 * Author: Matt Thomas
 * Version: 0.0.1
 * Author URI: http://guggenheim.org/
 */
 
@betweenbrain
betweenbrain / test-plugin.php
Last active July 25, 2018 15:37
Sample WP Plugin that supports admin options
<?php
/**
* Plugin Name: AAA Test Plugin
* Description: A sample plugin that supports admin options.
* Author: Matt Thomas
* Version: 0.0.1
*
* @package WordPress
*/