Skip to content

Instantly share code, notes, and snippets.

View wachpwnski's full-sized avatar

John Wachowski wachpwnski

View GitHub Profile
'use strict';
/* Singleton AutobahnJS Websocket Connection as AngularJS Service */
angular.module('AutobahnJSWebsocketService', [])
.factory('Websocket', ['$q', function($q) {
var openSession = null;
var isOpening = false;
var waitingList = [];
import re
def strip_margin(text):
return re.sub('\n[ \t]*\|', '\n', text)
def strip_heredoc(text):
indent = len(min(re.findall('\n[ \t]*(?=\S)', text) or ['']))
pattern = r'\n[ \t]{%d}' % (indent - 1)
return re.sub(pattern, '\n', text)