var _t; window.onbeforeunload = function(){ closeTime(); setTimeout(function(){_t = setTimeout(onunloadcancel, 0)}, 0); return...
分类:
其他好文 时间:
2014-10-11 20:40:36
阅读次数:
170
很多人把装饰器搞的很复杂,其实本质很简单.
首先,什么是装饰器呢?在代码中发现戴着@xxx帽子的,就是装饰器.
那要怎么自己定义一个装饰器呢?
其实任何一个接收一个参数的callable都可以用来做装饰器,比如函数和类.为方便起见,下面的例子都用函数来说明.
def deco(func):return 1
这里,deco就可以做装饰器.
@deco
def f(args):pass
...
分类:
编程语言 时间:
2014-10-11 20:05:36
阅读次数:
240
本文介绍Cocos2dx事件(下面简称Event)处理机制中的事件分发模块,在Event发生后,进过一系列处理,最后将会分发Event;
1、dispatchEvent& dispatchTouchEvent方法
voidEventDispatcher::dispatchEvent(Event* event)
{
if (!_isEnabled) return;
upd...
分类:
其他好文 时间:
2014-10-11 19:47:46
阅读次数:
226
Given an array and a value, remove all instances of that value in place and return the new length.
The order of elements can be changed. It doesn't matter what you leave beyond the new length.
S...
分类:
其他好文 时间:
2014-10-11 18:55:56
阅读次数:
185
string 增加 IsNullorEmpty :String.prototype.IsNullOrEmpty = function (r) { if (r === undefined || r === null || r === "") { return true; } else { return...
分类:
Web程序 时间:
2014-10-11 17:46:55
阅读次数:
242
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
class Solution {
public:
int largestRectangleArea(int* height, int length) {
...
分类:
其他好文 时间:
2014-10-11 17:37:26
阅读次数:
156
action中:设置属性并增加get,set方法,给属性赋值后(如:private String name; public String getName() { return name; } public void setName(String name) { this.name = name;.....
分类:
其他好文 时间:
2014-10-11 16:51:35
阅读次数:
237
Remove Duplicates from Sorted List I
Given a sorted linked list, delete all duplicates such that each element appear only once.
For example,
Given 1->1->2, return 1->2.
Given 1->1->2->3->3...
分类:
其他好文 时间:
2014-10-11 16:50:15
阅读次数:
206
代码中获取getActionbar().getHeight() 这个方法在onCreate中是获取不到高度的,平常使用还可以第二种,通过主题数据获取高度/** * 获取ActionBar 高度 * @param context * @return */ public static ...
分类:
其他好文 时间:
2014-10-11 16:26:45
阅读次数:
189
Remove Duplicates from Sorted Array I
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for an...
分类:
其他好文 时间:
2014-10-11 16:19:56
阅读次数:
140