I hereby claim:
- I am ziyoudefeng on github.
- I am hzshao (https://keybase.io/hzshao) on keybase.
- I have a public key ASA99Osnhqmitdd4gmbG_Qn7jApHosjjF7dcLW6fmTQtNQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
(function (root) { | |
var type = function (o) { | |
// handle null in old IE | |
if (o === null) { | |
return 'null'; | |
} | |
// handle DOM elements |
// answer to http://weibo.com/1915548291/z2UtyzuvQ | |
// see also http://www.cnblogs.com/baiyanhuang/archive/2012/11/11/2764914.html | |
#include <boost/bind.hpp> | |
#include <boost/function.hpp> | |
#include <boost/noncopyable.hpp> | |
#include <boost/ptr_container/ptr_vector.hpp> | |
#include <fstream> | |
#include <iostream> |
Authored by Peter Rybin , Chrome DevTools team
In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.
Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:
#include <assert.h> | |
#include <stdio.h> | |
#include <vector> | |
int buysell(const std::vector<int>& prices) | |
{ | |
assert(!prices.empty()); | |
size_t lowestBuy = 0; | |
size_t lowestBuySoFar = 0; | |
size_t highestSell = 0; |
#include <boost/noncopyable.hpp> | |
#include <pthread.h> | |
#include <stdlib.h> | |
// a superfluous check for pedantic people | |
inline void CHECK_SUCCESS(int ret) | |
{ | |
if (ret != 0) | |
{ | |
abort(); |
摘自:http://my.oschina.net/HardySimpson/blog/38985 | |
1:对象的生命周期 、数据访问的权限。我在实际编码中发现有下面几种 | |
数据权限 生命周期 | |
数据对象 直接读写内部数据 完成一次操作 | |
普通对象 直接读,通过方法或函数来写 按需使用 |
/* simple strstr: use strchr to look for first character */ | |
/* will change pointer value: str1*/ | |
char *strstr(const char *str1, const char *str2) | |
{ | |
int n; | |
n = strlen(str2); | |
for (;;) { | |
str1 = strchr(str1, str2[0]); |
/* 运行结果好像不正确 */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
enum { | |
NPREF = 2, | |
NHASH = 4093, | |
MAXGEN = 10000 | |
}; |
#大多数Ruby语句会返回值,这意味着可以把它们当条件使用。例如,gets方法从标准输入流返回下一行,或者当到达文件结束时返回nil。 | |
#因为Ruby在条件中把nil当作一个假值对待,可以像下面这样来处理文件中的行。 | |
while line = gets | |
puts line.downcase | |
end |