- 浏览: 52540 次
- 性别:
- 来自: 北京
文章列表
#coffeescript
isIE = /msie/i.test(navigator.userAgent)
traverseChildren = (elem)->
pushAll = (elemArray) ->
q.push item for item in elemArray
children = [];
q = [];
q.push(elem);
while q.length > 0
elem = q.pop();
children.push(elem);
...
#coffeescript
class Animate
constructor:(options={})->
@options = options
options.duration = options.duration or 300
self = this
self.easing =
swing: (p, n, firstNum, diff) ->
((-Math.cos(p * Math.PI) / 2) + 0.5) * diff + firstNum
linear: (p, n ...
//url解析
var url = 'http://weibo.com/u/1130985012/home?wvr=5#123456';
var re = /^(?:([a-zA-z]+):)?(\/{0,3})([0-9.\-a-zA-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/;
var result = re.exec(url)
console.log(result)
var names = ['url','protocol','slash','host','port','path','query','has ...
示例:
<!doctype html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
<script src="inputFormat.js">& ...
/**
* @author 全冠清
*/
(function($){
var methods = {
init: function(opts){
if(!$(window).data('register_messageline')){
$(window).data('register_messageline',true)
}else{
alert('error:只允许有一个请求总线')
return;
}
var defaults = {
actions:[],
...
数值
/**
* 转换&取整
*/
-45.67890^0 //-45
-45.67890|0 //-45
~~5645.1132 //5645
'-45.67890'^0 //-45
'-45.67890'|0 //-45
~~'5645.1132' //5645
/**
*金额处理
*/
Number.prototype.fixMoney=function(){
return this.toString().replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g,"$1,")
} ...
工作中小人作风的同事是阻碍你成功的暗礁,如果你不能事先发现这些暗礁并及时避开它们,那么你的事业之舟很可能会触礁,轻则抛锚、搁浅,重则被撞翻、撞沉。所以,和这种小人作风的同事搞好关系十分重要。
...
/**
* @author 全冠清
*/
$.fn.extend({
position:function( value ){
var elem = this[0];
if (elem&&(elem.tagName=="TEXTAREA"||elem.type.toLowerCase()=="text")) {
if($.browser.msie){
var rng;
if(elem.tagName == "TEXTAREA"){
...
上线时几个人同时过上百个文件,这时就需要列出修改过文件的列表
手工记录几乎不可能,这时可以用文件最后修改时间和开始修改时的时间做比较,这时就可以对比出列表
import os,os.path,re,time
filelist=[]
path = 'F:\hbtv'
t=time.strptime("2010-09-15 00:00:00", "%Y-%m-%d %H:%M:%S")
t= time.mktime(t)
for root, dirs, files in os.walk(path):
for file ...
测试关
2<<37
第1关
import string
str="g fmnc wms bgblr rpylqjyrc gr zw fylb. rfyrq ufyr amknsrcpq ypc dmp. bmgle gr gl zw fylb gq glcddgagclr ylb rfyr'q ufw rfgq rcvr gq qm jmle. sqgle qrpgle.kyicrpylq() gq pcamkkclbcb. lmu ynnjw ml rfc spj."
transfun=string.maketrans('abcdefgh ...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<title>jq sort</title>
< ...