This file contains 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 | |
import urllib2 | |
import json | |
def get_channels(): | |
channels = set() | |
url = "http://rcmsapi.chinacache.com:36000/customer/24quan/channels" | |
opener = urllib2.urlopen(url) |
This file contains 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
// Hello World! example user script | |
// version 0.1 BETA! | |
// 2005-04-25 | |
// Copyright (c) 2005, Mark Pilgrim | |
// Released under the GPL license | |
// http://www.gnu.org/copyleft/gpl.html | |
// | |
// -------------------------------------------------------------------- | |
// |
This file contains 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
from dateutil import rrule | |
from datetime import datetime | |
import re | |
def get_dates(): | |
dates = [] | |
dates.append({"start":'201101010000',"end":'201101012359'}) | |
return dates; | |
def beween_day(): | |
a = '20110101' |
This file contains 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 | |
#encoding=utf-8 | |
#vim ft=python | |
#abstract: 演示Python中正则表达式的基本用法 | |
#tag:Python RegExp example | |
import re | |
#辅助函数,打印一个matchobject的信息 |
This file contains 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
# Lookaheads | |
jeffrey@envato.com | |
jeffrey@jeffrey-way.com | |
jeffrey@envato.edu | |
jeffrey@jeffrey-way.au | |
jeffrey@jeffrey-way.tv | |
正则匹配表达式: @.+(?=\.[a-z]{2,4}) | |
解释: | |
@ 匹配@ | |
. 匹配任意字符 |
This file contains 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
# negative lookbehind | |
display:box; box-shadow: 1px 2px 3px black; box-sizing: 100% 100%; | |
逐行解释: | |
(?<!: ) Negative lookbehind 不包含前面含有 : 号的box | |
[^;] 不是分号的所有字符 | |
+ 前面不是分号的所有字符1个或多个 | |
; 匹配一个分号 |
This file contains 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
# negative lookbehind | |
display:box; box-shadow: 1px 2px 3px black; box-sizing: 100% 100%; | |
逐行解释: | |
(?<!: ) Negative lookbehind 不包含前面含有 : 号的box | |
[^;] 不是分号的所有字符 | |
+ 前面不是分号的所有字符1个或多个 | |
; 匹配一个分号 |
This file contains 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
it('inherts',function () { | |
var Model = new Class( | |
{ | |
initialize:function (name) { | |
this.name = name; | |
}, | |
save:function () { | |
return "my name is "+this.name; |
This file contains 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
//增加对象构造函数,call,apply 函数。 匿名函数,内存模型。 | |
var Class = function() { | |
var klass = function() { | |
if(typeof klass.constructor == 'function'){ | |
// klass.constructor (arguments[0]) | |
console.log(arguments[0]); | |
console.log(arguments[1]); | |
// console.log(arguments[2]); |
This file contains 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 Class = function () { | |
var klass = function () { | |
this.initialize.apply(this,arguments) //this中没有init,找原型 | |
}; | |
klass.fn = klass.prototype;//todo 污染 | |
return klass; | |
}; | |