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
function defineReactive(option) { | |
var o = {}; | |
var data = option.data; | |
var funcs = {}; | |
var callstacks = o.callstacks = []; | |
var obs = o.obs = {}; | |
var notify = function (key) { |
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
-- 现在的local function的语法可以支持以下语法了,不用纠结 | |
-- pil3的说法看来是不对的.嗯,明显要出pil4的节奏 | |
local fact = function (n) | |
if n == 1 then | |
return 1 | |
end | |
return n * fact(n - 1) | |
end |
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
function seq(n) | |
return coroutine.wrap(function() | |
for i = 1, n do | |
coroutine.yield(i) | |
end | |
end) | |
end | |
function add4(a, b, c, d) |
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
# general Makefile for gmock/gtest | |
# by LelouchHe@gmail.com | |
############################################### | |
############################################### | |
# configuration | |
# set up your own config of test environment | |
############################################### | |
############################################### |
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
#include <stdio.h> | |
#include <stdint.h> | |
#define IS_SET(n, pos) ((n) & (1 << pos)) | |
union float_t { | |
float f; | |
uint32_t i; | |
struct { | |
uint32_t m : 23; |
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
bool next_permutation(int num[], size_t n) { | |
if (n <= 1) { | |
return false; | |
} | |
size_t top = n - 1; | |
while (top > 0 && num[top - 1] >= num[top]) { | |
top--; | |
} |
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
#define MAX_D_LEN 100 | |
static void build_next(const char *str, int len, int next[]) { | |
assert(str != NULL); | |
assert(len > 0); | |
assert(next != NULL); | |
next[0] = -1; | |
int i = 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
/* 下标: c & 0x7F */ | |
static const int char_map[] = { | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
-1, -1, -1, -1, -1, -1, -1, -1, | |
0, 1, 2, 3, 4, 5, 6, 7, | |
8, 9, -1, -1, -1, -1, -1, -1, |
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
struct node_t { | |
node_t *next; | |
}; | |
// x -> y -> z x -> y -> z -> a | |
// | | | |
// mid mid | |
node_t *find_mid(node_t *head) { | |
if (head == NULL) { | |
return NULL; |
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
Common subdirectories: libjson_7.6.1/_internal/Source/JSONDefs and libjson_7.6.1.mine/_internal/Source/JSONDefs | |
diff -uN libjson_7.6.1/_internal/Source/JSONWorker.cpp libjson_7.6.1.mine/_internal/Source/JSONWorker.cpp | |
--- libjson_7.6.1/_internal/Source/JSONWorker.cpp 2012-05-30 17:14:36.000000000 +0800 | |
+++ libjson_7.6.1.mine/_internal/Source/JSONWorker.cpp 2013-04-19 07:05:06.000000000 +0800 | |
@@ -275,12 +275,12 @@ | |
void JSONWorker::UTF(const json_char * & pos, json_string & result, const json_char * const end) json_nothrow { | |
JSON_ASSERT_SAFE(((long)end - (long)pos) > 4, JSON_TEXT("UTF will go out of bounds"), return;); | |
- json_uchar first = UTF8(pos, end); | |
+ json_uchar first = UTF8(pos, result, end); |
NewerOlder