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
<?php | |
class MysqlConnectorError extends Exception {} | |
/** | |
* Mysql 连接管理类 | |
* | |
* @author Sarah <tonshlee@gmail.com> | |
* | |
* <code> | |
* MysqlManager::instance() |
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
<?php | |
/** | |
* 日期分段类 | |
*/ | |
abstract class DateStep { | |
const DAYTIME = 86400 | |
const WEEKTIME = 86400 * 7 | |
protected $startTime; |
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 unittest | |
# 单例类 | |
class MyClassA(object): | |
_instance = None | |
def __init__(self): | |
self._a = 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 is_bissextil_year(year): | |
if (year % 4 == 0) and (year % 100 != 0): | |
return True | |
if year % 400 == 0: | |
return True |
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
$.fn.extend | |
historyPush: (options) -> | |
settings = | |
bind: '' | |
loader: '' | |
target: '' | |
callback: null | |
settings = $.extend settings, options |
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
# A class or plugin of ajax submit form with success callback method | |
class AjaxForm | |
#ajax submit class | |
constructor: (form) -> | |
@form = form | |
init: (callback) -> | |
@form.submit => |
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 urlparse | |
import unittest | |
def convert_relative_to_absolute(url, base_url): | |
base_url = base_url or '' | |
if not url: | |
return base_url |
NewerOlder