Skip to content

Instantly share code, notes, and snippets.

Joshua Mervine jmervine

Block or report user

Report or block jmervine

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jmervine /
Created Jan 31, 2014
Simple Ruby version switcher...
# add this to your .bashrc / .zshrc / etc
if test -e ~/scripts/; then
function chrb {
CURRENT_VERSION="$1" source ~/scripts/
jmervine / gist:8788669
Created Feb 3, 2014
Strip specials in BASH
View gist:8788669
# replaces numbers, commas, periods, asterisks, slashes (forward and back), all brackets and parentheses
# note: I'd like to get this working with less '-e' calls but it wasn't for me on
# $ sed --version
# GNU sed version 4.2.1
sed -r -e 's/[0-2,\.\*\\\/]/_/g' -e 's/\[/_/g' -e 's/\]/_/g' -e 's/\{/_/g' -e 's/\}/_/g' -e 's/\(/_/g' -e 's/\)/_/g' -e 's/_{2,}/_/g' -e 's/_$//'
jmervine / .travis.yml
Last active Aug 29, 2015
request -> requets-lite
View .travis.yml
language: node_js
- 0.8
- 0.10
jmervine / ssl.js
Created Feb 17, 2014
MaxCDN working SSL cert upload.
View ssl.js
#!/usr/bin/env node
* Example script for uploading ssl certs to maxcdn
* pull zone.
* Setup to run this script:
* $ npm install maxcdn http-debug
View gist:9127845
Server running on port 8000
-> /mervine_net
View tab-helper.js
$(window).load(function() {
var hash;
var hash_suffix='_tab';
jmervine /
Last active Aug 29, 2015
MaxCDN Node.js Blog Draft

An Introduction to MaxCDN on Node.js

In addition to [MaxCDN]'s powerful [Oauth] API, they offer a number of simple modules for various languages. Here I'll be covering they're [Node.js] module.

In this post, I'll go over some basic examples of how to display reports and purge caches using the [MaxCDN Node module], which like all of [MaxCDN]'s modules, is open sourced at [].

If you're like me and prefer to read up on the technologies you'll be using in this post before diving in, here's what we'll be using:

  • [Node.js], "a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications"
  • [npm], "Node Packaged Modules"
View app.js
'use strict';
var express = require('express');
var MaxCDN = require('maxcdn');
// Initialize maxcdn from environment.
var maxcdn = new MaxCDN(process.env.ALIAS,
// For this example, I'll restrict to a single zone,
jmervine / Gemfile
Created Feb 26, 2014
Simple Web Interface to Purge Caches via MaxCDN
View Gemfile
source ""
gem "sinatra"
gem "haml"
gem "maxcdn"
View 1test.js
var cluster = require('cluster');
var numCPUs = require('os').cpus().length;
var results = [];
var responded = 0;
if (cluster.isMaster) {
for (var i = 0; i < numCPUs; i++) {
You can’t perform that action at this time.