This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var replaceContentBetweenGivenTagPair = function (str, tagName) { | |
| var regex = new RegExp('<' + tagName + '>([^(<'+ tagName+'>)]*?)</' + tagName + '>', 'g'); | |
| while (regex.test(str)){ | |
| str = str.replace(regex, '$1'); | |
| } | |
| return str; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var SingletonTester = (function () { | |
| // options: an object containing configuration options for the singleton // e.g var options = { name: 'test', pointX: 5}; | |
| function Singleton(options) { | |
| // set options to the options supplied or an empty object if none provided. | |
| options = options || {}; | |
| //set the name parameter | |
| this.name = 'SingletonTester'; //set the value of pointX |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var clearTagPairs = function (str, tagName) { | |
| var regex = new RegExp('<' + tagName + '>([^(<'+ tagName+'>)]*?)</' + tagName + '>', 'g'); | |
| while (regex.test(str)){ | |
| str = str.replace(regex, '$1'); | |
| } | |
| return str; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def typeassert(*ty_args, **ty_kwargs): | |
| def decorate(func): | |
| if not __debug__: | |
| return func | |
| sig = signature(func) | |
| bound_types = sig.bind_partial(*ty_args, **ty_kwargs).arguments | |
| @wraps(func) | |
| def wrapper(*args, **kwargs): | |
| bound_values = sig.bind(*args, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 同时修饰classmethod,bound_method, function的decorator | |
| """ | |
| from functools import wraps | |
| import types | |
| class Profile: | |
| def __init__(self, func): | |
| wraps(func)(self) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| method和function是一回事,classmethod则是另一个类型,所有对类中方法的调用都是经过了descriptor变换成bounded method对象,最后再访问 | |
| 类型为<class 'method-wrapper'>的__call__属性 | |
| 这么看来其实也是classmethod,method,function都是统一到了descriptor对象, | |
| """ | |
| from functools import wraps | |
| class my_classmethod: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import re | |
| def replace(pattern, string, callback): | |
| ary = [] | |
| if isinstance(pattern, str): | |
| pattern = re.compile(pattern) | |
| founds = {} | |
| for match in pattern.finditer(string): | |
| found = match.group(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def handle_a(action): | |
| return 'a' | |
| def handle_b(action): | |
| return 'b' | |
| def handle_c(action): | |
| return 'c' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p><span style="font-size: 32px;">上</span>海诸多“美食一条街”中,老派如云南南路、黄河路,新晋如进贤路、<strong>古羊路</strong>,但在上海马路文化的忠实拥趸和美食品鉴者口中,两条地处法租界却风格迥异的街道总会被一同提及——武康路和永康路。</p> | |
| <p> 两条“康”字辈儿的街道,不仅是游人食客的聚集地,同时也是外国友人的心头好,一大批网红店应运而生,就连餐饮业态都有几分神似。这两条马路的美味加在一起,就是一个大写的洋气:精品咖啡、手工面包、网红冰淇淋、精酿啤酒吧、法式小酒馆……</p> | |
| <p> <img src="https://i.imgsafe.org/0ff704dd3b.png" class="pg-image-catalog" data-width-height-radio="0.65"></p> | |
| <p> 永康路尽管也位于法租界内,相较于武康路却更像隐藏在欧陆风情背面的另类空间:夹在太原路和嘉善路当中,襄阳南路横亘其间,和武康路独门独院的花园洋房、道路两旁成排连荫的梧桐相比,永康路的街边铺面要拥挤得多:</p> | |
| <p> 有人调侃,永康路是“屌丝老外一条街”,大抵由于市井气息更浓,这里一向游人如织。撇开玩笑不谈,鲜有食客和玩家们关注这条街的历史:在成为颇具异国风情的上海新地标之前,这里只是一座脏乱差的菜市场。</p> | |
| <p><img src="https://i.imgsafe.org/100de4a142.jpg" class="pg-image-content" data-width-height-radio="1.77"></p> | |
| <p style="text-align: center;"> <span style="color: rgb(245, 172, 89);"> I.永康路</span></p> | |
| <p> 美食地标成名的原因多半相似,你可以大手一挥将之归结为招商开发的成果(并非很多人想象中街道商业的自然生长)。不同的,武康路能有今天的热度,大概只需感谢一个人,而永康路则需要感谢一群人。</p> | |
| <p> 武康路以武康庭为中心 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| import logging.config | |
| import time | |
| import functools | |
| from flask import request | |
| from horo.core.exc import APIException |
OlderNewer