Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Matt Thomas betweenbrain

💭
I may be slow to respond.
View GitHub Profile
@betweenbrain
betweenbrain / vue-route-guard-apollo-query.js
Last active Jul 10, 2019
Vue Apollo query from within Vue router route guard
View vue-route-guard-apollo-query.js
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 Jul 17, 2022
WordPress Flash Messaging
View wp-flash.php
<?php
/**
* Triggers validation when a post is saved.
*/
add_action(
'save_post',
'validate_post',
10,
3
@betweenbrain
betweenbrain / fieldmanager-hooks.md
Created Feb 11, 2019
WordPress Fieldmanager Hooks
View fieldmanager-hooks.md

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
View vue-createElement.lighthouse.report.json
{"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
View vue-jsx.lighthouse.report.json
{"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
View vue-template.lighthouse.report.json
{"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 Nov 16, 2018
Vue.js watch element by ref
View vue-watch.vue
<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 Oct 4, 2018
[WIP] VS Code, Lando and Xdebug w/ profiling
View VS-Code-Xdebug-Lando.md
@betweenbrain
betweenbrain / wp-rest-plugin.md
Created Jun 18, 2018
WordPress plugin to capture REST API cookie header
View wp-rest-plugin.md
<?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 Jul 25, 2018
Sample WP Plugin that supports admin options
View test-plugin.php
<?php
/**
* Plugin Name: AAA Test Plugin
* Description: A sample plugin that supports admin options.
* Author: Matt Thomas
* Version: 0.0.1
*
* @package WordPress
*/