Skip to content

Instantly share code, notes, and snippets.

View stash's full-sized avatar
🎯
Focusing

Jeremy Stashewsky stash

🎯
Focusing
View GitHub Profile
@stash
stash / manual-https.js
Created January 29, 2014 17:34
very simple HTTPS diagnostic tool using just the TLS module in node.js
/*jshint node:true */
'use strict';
var tls = require('tls');
var body = new Buffer(JSON.stringify({whatever:'ayup'}), 'utf8');
var sock = tls.connect({host: 'example', port: 443}, function() {
console.log('connected');
sock.write("POST /v1/heroku/resources?stash=1 HTTP/1.1\r\n"+
"accept: application/json\r\n"+
@stash
stash / travis-pop.js
Created February 6, 2014 00:07
UserScript to open github Travis-CI links in a new tab
// ==UserScript==
// @name github travis link
// @namespace urn://userscripts/stash/github/travis-link
// @include https://github.com/*/*/pull/*
// @exclude https://github.com/*/*/pull/new
// @version 1
// @grant none
// ==/UserScript==
var links = document.getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
@stash
stash / github-issue-title.js
Last active August 29, 2015 13:56
UserScript to prefix github tab titles with the issue or PR number
// ==UserScript==
// @name github issue titles
// @namespace urn://userscripts/stash/github-issue-titles
// @include https://github.com/*/*/issues/*
// @include https://github.com/*/*/issue/*
// @include https://github.com/*/*/pulls/*
// @include https://github.com/*/*/pull/*
// @exclude https://github.com/*/*/*/new
// @version 2
// @grant none
@stash
stash / fun-with-sinon-mocks.js
Created February 25, 2014 18:08
sinon mock object play
/*jshint node:true */
'use strict';
var assert = require('assert');
var sinon = require('sinon');
var util = require('util');
function spew(label, o) {
console.log(label, util.inspect(o, {colors:true, depth:null}));
}
@stash
stash / app.js
Last active August 29, 2015 13:56
SVG processor express app
var fs = require('fs');
var util = require('util');
var Transform = require('stream').Transform; // import the Transform class
var express = require('express');
var SVGO = require('svgo'); // svg optimizer - https://github.com/svg/svgo
/**
* Express setup goo goes here
*/

Keybase proof

I hereby claim:

  • I am stash on github.
  • I am stash (https://keybase.io/stash) on keybase.
  • I have a public key whose fingerprint is 57C8 8A18 B8A2 7183 F1D2 508D E8B2 D70F 321F 87A1

To claim this, I am signing this object:

@stash
stash / cancellable-jobs-queue.js
Created March 11, 2014 19:54
Cancellable job queue
var async = require('async');
var q = async.queue(runner, 1);
function singular(fn) {
return function() {
if (!fn) {
return;
}
var cb = fn;
@stash
stash / mrb.sh
Created March 25, 2014 21:32
most-recently-used git branches (Perl one-liner)
git reflog | perl -ne 'print $1,$/ if (/checkout: moving from .+? to (.+)$/ && !$seen{$1}++)'
@stash
stash / istanbul-mocha-package.json
Created May 22, 2014 19:48
Istanbul-Mocha integration via `npm run coverage`
{
"name": "whatever",
"version": "0.0.0",
"main": "index.js",
"scripts": {
"test": "mocha tests",
"coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha tests"
},
"devDependencies": {
"mocha": "~1.18.2",
@stash
stash / gpg-transition.txt
Created November 20, 2014 00:30
gpg key transition
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I'm transitioning GPG keys.
My old key is
pub 4096R/321F87A1 2012-06-13 [expires: 2016-06-01]
Key fingerprint = 57C8 8A18 B8A2 7183 F1D2 508D E8B2 D70F 321F 87A1
uid Jeremy Stashewsky <jeremy@goinstant.com>