Skip to content

Instantly share code, notes, and snippets.

View RishabhVerma's full-sized avatar
🎯
Focusing

Rishabh Verma RishabhVerma

🎯
Focusing
  • New Delhi, India
View GitHub Profile
@lost-theory
lost-theory / gist:3925738
Created October 21, 2012 04:29
different delimiters in jinja2 + flask
from flask import Flask, render_template_string, request
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
block_start_string='<%',
block_end_string='%>',
variable_start_string='%%',
variable_end_string='%%',
comment_start_string='<#',
@bre-17387639
bre-17387639 / url_matcher.py
Created March 27, 2012 04:14
Daring Fireball URL RegEx Matcher for Python
import re
def url_matcher():
"""
See: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
"""
return re.compile(
ur"""(?i)\b((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)"""
ur"""(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+"""
ur"""(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()"""