I hereby claim:
- I am dmitric on github.
- I am dmitric (https://keybase.io/dmitric) on keybase.
- I have a public key ASA_hdjGryyH4aXeTpn4vr5AHZFlqhgPvOrbjh0ftsrUago
To claim this, I am signing this object:
# -*- coding: utf-8 -*- | |
from markdown import Extension | |
from markdown.util import etree | |
from markdown.inlinepatterns import Pattern | |
SOURCES = { | |
"youtube": { | |
"re": r'youtube\.com/watch\?\S*v=(?P<youtube>[A-Za-z0-9_&=-]+)', | |
"embed": "//www.youtube.com/embed/%s" | |
}, |
import { svgPathProperties } from "svg-path-properties" | |
calculateConnectionsBetweenPaths (d, lastd, segments) { | |
// Take in two "d" attribute string and break then down into N segements | |
// and return a list of those points | |
const connections = [] | |
// Given a path's value of d, get the total length of the path | |
const pp = new svgPathProperties(d) |
class Backend(object): | |
"""Allows access to backend and removes logic from handlers""" | |
def __init__(self): | |
"""Inititalize with the variables you need""" | |
self.__users_data = None | |
self.db = Connection( | |
options.db_host, | |
options.db, | |
user=options.db_user, |
I hereby claim:
To claim this, I am signing this object:
class Backend(object): | |
def __init__(self): | |
engine = create_engine("mysql://{0}:{1}@{2}/{3}".format(options.mysql_user, options.mysql_pass, options.mysql_host, options.mysql_db) | |
, pool_size = options.mysql_poolsize | |
, pool_recycle = 3600 | |
, echo=options.debug | |
, echo_pool=options.debug) | |
self._session = sessionmaker(bind=engine) | |
@classmethod |
def _sign_params(self, params, host, uri="/", action="GET"): | |
buffer = "%s\n" % action | |
buffer += "%s\n" % host | |
buffer += "%s\n" % uri | |
buffer += '&'.join("%s=%s" % (self._quote(i[0]), self._quote(i[1])) for i in sorted(params.items())) | |
signature = base64.b64encode( | |
hmac.new(self.secret_access_key, buffer, hashlib.sha256).digest() | |
) | |
return signature |
from misaka import HtmlRenderer | |
import re | |
SOURCES = { | |
"youtube": { | |
"re": r'https?://(www\.|)youtube\.com/watch\?\S*v=(?P<youtube>[A-Za-z0-9_&=-]+)\S*', | |
"embed": u"//www.youtube.com/embed/%s" | |
}, | |
"vimeo": { | |
"re": r'https?://(www\.|)vimeo\.com/(?P<vimeo>\d+)\S*', |
class FacebookGraphLoginHandler(BaseHandler, tornado.auth.FacebookGraphMixin): | |
@tornado.web.asynchronous | |
def get(self): | |
my_url = (self.request.protocol + "://" + self.request.host +"/login/facebook?next="+tornado.escape.url_escape(self.get_argument("next", "/"))) | |
if self.get_argument("code", False): | |
self.get_authenticated_user(redirect_uri=my_url,client_id=self.settings["facebook_api_key"],client_secret=self.settings["facebook_secret"],code=self.get_argument("code"),callback=self._on_auth,extra_fields=['email']) | |
return | |
self.authorize_redirect(redirect_uri=my_url,client_id=self.settings["facebook_api_key"],extra_params={"scope": "read_stream,email,offline_access"}) | |
def _on_auth(self, user): |
static inline NSRegularExpression * TagRegularExpression() { | |
static NSRegularExpression *_tagRegularExpression = nil; | |
static dispatch_once_t onceToken; | |
dispatch_once(&onceToken, ^{ | |
_tagRegularExpression = [[NSRegularExpression alloc] initWithPattern:@"\\#[\\w]+" | |
options:NSRegularExpressionCaseInsensitive | |
error:nil]; | |
}); | |
Traceback (most recent call last): | |
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/web.py", line 1021, in _stack_context_handle_exception | |
raise_exc_info((type, value, traceback)) | |
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/stack_context.py", line 258, in _nested | |
yield vars | |
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/stack_context.py", line 228, in wrapped | |
callback(*args, **kwargs) | |
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/gen.py", line 382, in inner | |
self.set_result(key, result) | |
File "/Users/DLC/.virtualenvs/b/lib/python2.7/site-packages/tornado/gen.py", line 315, in set_result |