Skip to content

Instantly share code, notes, and snippets.

View chriszarate's full-sized avatar
👋
hi

Chris Zarate chriszarate

👋
hi
View GitHub Profile
networkInterface.use([{
applyMiddleware(req, next) {
console.log(req.request);
next();
}
}]);
$ git add -p src
diff --git a/src/publish.js b/src/publish.js
index 196e8aa..e1fa7df 100644
--- a/src/publish.js
+++ b/src/publish.js
@@ -43,11 +43,10 @@ module.exports = async () => {
// Render aggregation pages.
await publishHtml( 'home', 'index.html', { posts } );
- await publishHtml( 'archive', 'archive', { posts } );
@chriszarate
chriszarate / debug-fastly.md
Last active June 1, 2020 16:47
Debug Fastly response

Debugging browser requests to Fastly objects

Fastly allows you to add a special header to your request which instructs it to include detailed cache information in the response. This information is useful in debugging cache issues, especially around max-age and surrogate keys.

In Firefox

Firefox's dev tools make it easy to edit and resend an HTTP request. Use this flow to add the Fastly debug header in the browser:

  1. Open Dev Tools and switch to the Network tab. You may need to refresh the page to capture the request for the current page.
@chriszarate
chriszarate / thumbnail.png
Last active March 17, 2021 00:57
Identify your tmux windows with food emoji
thumbnail.png
@chriszarate
chriszarate / wp-graphql-co-authors-plus.php
Created March 1, 2022 00:45
WPGraphQL CoAuthorsPlus
<?php
/**
* Plugin Name: GraphQL integration with Co-Authors Plus
* Author: WPGraphQL
* Version: 0.1.0
* Requires at least: 5.0.0
*
* @package wp-graphql-co-authors-plus
*/
@chriszarate
chriszarate / vnc-over-ssh.sh
Created July 15, 2015 03:39
VNC over SSH via bastion
# You want to VNC to Box A but you don't have access to it
# over public Internet. You do have SSH access to Box B in
# the same private network.
# firewall
# ┌─────┐ ╏╏ ┌─────┐
# │ You │──SSH──╏╏────│ B │ bastion
# └─────┘ ╏╏ └──┬──┘
# ╏╏ SSH
# ╏╏ ┌──┴──┐
@chriszarate
chriszarate / getTextNodesBetween.js
Last active April 1, 2023 13:45
Native JavaScript function to get all *text* nodes contained in a selection object.
// Get all *text* nodes contained in a selection object.
// Adapted from code by Tim Down.
// http://stackoverflow.com/questions/4398526/how-can-i-find-all-text-nodes-between-to-element-nodes-with-javascript-jquery
function getTextNodesBetween(selection) {
var range = selection.getRangeAt(0), rootNode = range.commonAncestorContainer,
startNode = range.startContainer, endNode = range.endContainer,
startOffset = range.startOffset, endOffset = range.endOffset,
pastStartNode = false, reachedEndNode = false, textNodes = [];
function getTextNodes(node) {
var val = node.nodeValue;