Skip to content

Instantly share code, notes, and snippets.

Avatar

John Wachowski wachpwnski

View GitHub Profile
@wachpwnski
wachpwnski / correct.py
Created Apr 9, 2015
apiDoc requires incorrect usage of docstring to global apiDefine
View correct.py
"""
@apiDefine admin User access only
This optional description belong to to the group admin.
@apiDefine owner User access only
This optional description belong to to the group owner.
"""
import foo
View gist:f27f44ee6bf01ffe513d
'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 = [];
View text_strip_margin.py
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)