Skip to content

Instantly share code, notes, and snippets.

Steve Mason spmason

Block or report user

Report or block spmason

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
spmason / logging.js
Created Jan 24, 2012
A simple node module that makes console.log/error/warn/debug statements log through winston (simply include at the beginning of your app)
View logging.js
'use strict';
var util = require('util'),
winston = require('winston'),
logger = new winston.Logger(),
production = (process.env.NODE_ENV || '').toLowerCase() === 'production';
module.exports = {
middleware: function(req, res, next){, req.url, res.statusCode);
spmason /
Last active May 3, 2019
withGCloudCredentials Jenkins pipeline library plugin

This code is a Jenkins Shared Library plugin that allows you to run a command with specific gcloud credentials stored in Jenkins by the google-oauth-plugin

Note: You must have the "Google Cloud SDK" plugin installed, and a custom tool called gcloud setup for the activation to work (though this should work without that if you have another way of getting gcloud onto your slave machine)


withGCloudCredentials(<projectName>, <credentialsId>) {
  sh "gcloud <command>"
  sh "gsutil <command>"
spmason / mustache.js
Created Apr 11, 2012
RequireJS Module for loading Mustache templates
View mustache.js
* RequireJS mustache plugin
* usage:
* require(['ModuleA', 'mustache!myTemplate'], function (ModuleA, myTemplate) {
* var a = new ModuleA();
* var html = myTemplate({foo: 'bar'});
* $(a.el).html(html);
* });
spmason / pr
Last active Sep 29, 2017
GitHub "open PR" script. Add somewhere in your path, then opening a PR is as easy as typing `pr` on the branch you want to open a PR for
View pr
#!/usr/bin/env bash
# GitHub "Open Pull Request" script
# Add somewhere in your path, then opening a PR is as easy as typing `pr` while you're
# on the branch you want to open a Pull Request for
# - If working from a fork, name your fork's remote "origin" and the main repo "upstream"
# - `pr <branch_name>` will open a PR against the branch you give - rather than "master".

Keybase proof

I hereby claim:

  • I am spmason on github.
  • I am spmason ( on keybase.
  • I have a public key ASAceBYevAn4wzt1xOUf4yh78gRqksgRkZl5ZdGwl1Qgugo

To claim this, I am signing this object:

spmason / gist:7889481
Created Dec 10, 2013
Checkout PRs. I'm not sure where I got this from but I can't take credit for it
View gist:7889481
# Checks out a PR to a pr/<number> local branch
# Usage: git pr <number> [<upstream>]
git config --global '!git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1 && :'
# Deletes pr/<number> branches
# Usage: git pr-clean
git config --global '!git for-each-ref refs/heads/pr/* --format='"'"'%(refname)'"'"' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done'
You can’t perform that action at this time.