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
| /** | |
| * TODO refactor | |
| */ | |
| @Override | |
| public XResPostableStatus canXResPostable(XResPostableOrder order) { | |
| boolean valid = true; | |
| String msg = null; | |
| String orderStatus = order.getOrderStatus(); | |
| OrderCategory orderCategory = order.getOrderCategory(); |
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
| \documentclass[8pt]{memoir} | |
| \usepackage[utf8]{inputenc} | |
| \usepackage[paperwidth=9cm, paperheight=11.5cm, top=0.5cm, left=0.5cm, right=0.5cm, bottom=0.5cm]{geometry} | |
| \usepackage{graphicx} | |
| \usepackage{tikz, blindtext} | |
| \makechapterstyle{box}{ | |
| \renewcommand*{\printchaptername}{} | |
| \renewcommand*{\chapnumfont}{\normalfont\sffamily\huge\bfseries} | |
| \renewcommand*{\printchapternum}{ |
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
| ## Ignore Python compiled files | |
| *.pyc | |
| ## Ignore vim temporary files | |
| *.swp | |
| *~ | |
| ## Ignore JetBrains temporary files | |
| .idea/ |
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
| #!/usr/bin/env/ python | |
| #coding=utf-8 | |
| import mechanize | |
| import cookielib | |
| import itertools | |
| import string | |
| import threading | |
| import time | |
| # Cookie Jar | |
| cj = cookielib.LWPCookieJar() |
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 ConfigParser, sys | |
| _data = ConfigParser.ConfigParser() | |
| _data.read(sys.argv[1]) |
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
| # -*- coding: utf-8 -*- | |
| ''' | |
| 输入一个数组(元素假设为整数),对其元素进行赋值(赋予权重,为整数),使得 | |
| - 每个元素的权重至少为1 | |
| - 如果某一元素比其相邻的元素大(左或右),那么该元素的权重也比对应元素的权重大 | |
| 输出:权重最小的赋值算法 | |
| 解决思路: |
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
| #!/usr/bin/env python | |
| # -*- coding: utf-8 | |
| """ | |
| Search longest common substrings using generalized suffix trees built with Ukkonen's algorithm | |
| Author: Ilya Stepanov <code at ilyastepanov.com> | |
| (c) 2013 | |
| """ |
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
| # -*- coding: utf-8 -*- | |
| # 依次替换示例 | |
| def f(m, count=[0]): | |
| count[0] += 1 | |
| return str(count[0]) | |
| re.sub('a', f, 'ababab') | |
| # 输出为 | |
| # '1b2b3b' |
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
| # -*- coding: utf-8 -*- | |
| import re | |
| def changeText(paragraph, prefix, countMatch = 0): | |
| pattern = r'[①②③④⑤⑥⑦⑧⑨⑩]' | |
| text = '<a class="duokan-footnote" href="%s#df-%d"><img src="../Images/note.png"/></a>' | |
| def changeRule(matchobj): | |
| nonlocal countMatch | |
| countMatch += 1 | |
| return text % (prefix, countMatch) |
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
| #!/usr/bin/python -O | |
| # partition A[p:r] in place about x, and return the final position of the pivot | |
| def partition(A, p, r, x): | |
| # find the index of the pivot | |
| i = -1 | |
| for j in range(p, r): | |
| if A[j] == x: | |
| i = j | |
| break |