I hereby claim:
- I am robertklep on github.
- I am robertklep (https://keybase.io/robertklep) on keybase.
- I have a public key whose fingerprint is F5E0 E8F1 5938 70C3 501D 2896 3CAF 44BE 0135 D038
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
# wrapper for middleware classes (I'm using this in combination with django-sse) | |
def EventStreamMiddlewareWrapper(original): | |
original_method = getattr(original, 'process_response', None) | |
if not original_method: | |
return original | |
def new_method(self, request, response): | |
# return immediately when the response is an event stream | |
if 'text/event-stream' in response.get('Content-Type', ''): | |
return response |
import unicodedata | |
def remove_diacritics(s): | |
nkfd_form = unicodedata.normalize('NFKD', unicode(s)) | |
return u"".join([c for c in nkfd_form if not unicodedata.combining(c)]) |
# -*- coding:utf-8 -*- | |
import re | |
STOPWORDS = re.compile(r'(?u)\b(?:a(?:(?:an|b(?:er|o(?:ut|ve))|fter|gain(?:st)?|l(?:(?:g(?:un(?:as|os)|o)|l(?:e[mnrs]?)?|so?|tijd))?|n(?:(?:d(?:er(?:(?:e[mnrs]?|[mnrs]))?)?|tes?|y))?|re|u(?:ch|[fs])|[mst]))?|b(?:e(?:(?:cause|en|fore|i(?:ng)?|low|tween|n))?|i(?:st?|[jn])|oth|ut|y)|c(?:o(?:mo|n(?:tra)?)|ua(?:ndo|l))|d(?:a(?:(?:ar|mit|nn?|s(?:selbe)?|zu|[tß]))?|e(?:(?:in(?:e[mnrs]?)?|m(?:selben)?|n(?:(?:selben|n))?|r(?:(?:er|selben?))?|s(?:(?:de|se(?:lben|n)))?|ze|l))?|i(?:ch|e(?:s(?:e(?:(?:lben?|[mnrs]))?)?)?|[drt])|o(?:(?:ch|e[ns]|ing|nde|or|rt|wn))?|u(?:(?:r(?:ante|ch|ing)|s))?)|e(?:(?:ach|ens?|in(?:(?:e[mnrs]?|ig(?:e[mnrs]?)?|mal))?|l(?:l(?:as?|os))?|n(?:tre)?|r(?:(?:a(?:(?:is|[ns]))?|es))?|s(?:(?:as?|os?|t(?:a(?:(?:ba(?:(?:is|[ns]))?|d(?:(?:as?|os?))?|mos|ndo|r(?:(?:emos|á[ns]?|é(?:is)?|ía(?:(?:is|mos|[ns]))?))?|s))?|e(?:mos)?|o[sy]?|uv(?:i(?:e(?:r(?:a(?:(?:is|[ns]))?|on)|se(?:(?:is|[ns]))?)|mos|ste(?:is)?|é(?:ramos|semos))|[eo])|á(?:(?:bamos|is|[ns]))?|é(?:(?:is|[ns]))?)|e |
String.prototype.softbreak = function(minimum_size) { | |
return this | |
.toString() | |
.replace( | |
new RegExp('(.{' + (minimum_size || 5) + '})', 'g'), | |
'$1­' | |
); | |
}; |
Date.prototype.AGE_TABLE = [ | |
[ 60, 'second' , 'seconds' ], | |
[ 3600, 'minute' , 'minutes' ], | |
[ 86400, 'hour' , 'hours' ], | |
[ 604800, 'day' , 'days' ], | |
[ 2628030, 'week' , 'weeks' ], | |
[ 31557600, 'month' , 'months' ], | |
[ 4294967295, 'year' , 'years' ] | |
]; |
Number.prototype.sizify = function(precision) { | |
if (precision === undefined) | |
precision = 1; | |
if (this > 1200000000) | |
return (this / 1000000000.0).toFixed(precision) + ' G'; | |
if (this > 1200000) | |
return (this / 1000000.0).toFixed(precision) + ' M'; |
/** | |
* Pure CSS "dubstep forbidden" sign... | |
*/ | |
html, body { | |
margin : 0; | |
padding : 0; | |
width : 100%; | |
height : 100%; | |
font-family : sans-serif; |
/** | |
* CSS3 dialog experiment | |
*/ | |
html, body { | |
margin : 0; | |
padding : 0; | |
width : 100%; | |
height : 100%; | |
font-family : 'Montserrat Alternates'; |
/** | |
* Nyancats like to run in circles... | |
*/ | |
html, body { | |
margin : 0; | |
padding : 0; | |
width : 100%; | |
height : 100%; | |
font-family : sans-serif; |