Skip to content

Instantly share code, notes, and snippets.

none of your business

Chris Zarate chriszarate

View GitHub Profile
View git-add.patch
$ 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 } );
View apollo-client-log-queries.js
applyMiddleware(req, next) {
chriszarate /
Created Jul 15, 2015
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 /
Created Mar 2, 2015
WordPress Multisite HTTP to HTTPS migration
# WordPress Multisite HTTP to HTTPS migration
# Use wp-cli to assist HTTP to HTTPS migration for a WP Multisite installation.
# Update site metadata for the main site as well as each site in the network.
chriszarate / thumbnail.png
Last active Aug 16, 2018
Identify your tmux windows with food emoji
chriszarate / flickr-biggest.js
Created May 23, 2013
Bookmarklet to get largest available photo from a Flickr photo page. Fits in a tweet! (82 characters)
View flickr-biggest.js;window.location=P[Object.keys(P).pop()].url;
View A cheapskate on Amazon

September 29 2010, 9:23 PM

Amazon’s EC2 service now allows you to boot from persistent EBS volumes—a boon to those of us who like to run the occasional server-hour but don’t want to mess with bundling AMIs and other atrocities. The [AWS Management Console][1] automates most tasks, but you might find yourself quickly running into a two-part annoyance: (1) if you use public AMIs, the size of your EBS volume is chosen for you; and (2) EBS volumes are not resizable—at least, [not downwards][2]. Since Amazon charges you for allotted space on EBS volumes, this “annoyance” can literally cost you [tens of cents][3] per month!

Luckily, there is a workaround, and it has the side benefit of allowing you to boot one EBS volume on different instance types—that is, boot up your volume on an “m1.small” instance one day, a “c1.medium” the next, and so on. What follows assumes familiarity with Amazon Web Services and EC2, UNIX/Linux, the command-line, computers, typing, pants-wearing, etc.

Ok: Launch an EC2 instance fr

chriszarate / getTextNodesBetween.js
Last active Dec 30, 2018
Native JavaScript function to get all *text* nodes contained in a selection object.
View getTextNodesBetween.js
// Get all *text* nodes contained in a selection object.
// Adapted from code by Tim Down.
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;
# as root
/etc/init.d/apache2 stop
easy_install --upgrade Trac==1.0
trac-admin /var/trac/sites/my-trac upgrade
trac-admin /var/trac/sites/my-trac wiki upgrade
/etc/init.d/apache2 start
chriszarate / bp-custom.php
Last active Dec 12, 2015
BuddyPress 1.6 custom site avatars.
View bp-custom.php
BuddyPress 1.6 custom site avatars.
Add to (or create) /wp-content/plugins/bp-custom.php.
Or place in theme's functions.php.
Use a specific user's avatar for a site.
You can’t perform that action at this time.