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
## 空state,不产生任何的效果 | |
class State(object): | |
def __init__(self): | |
pass | |
def enter(self, entity, param_table, state_maintain, global_maintain): | |
pass | |
def update(self, entity, param_table, state_maintain, global_maintain): | |
pass |
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
-- Internal register table | |
local _class={} | |
--Create an class(为了不与cocos2d-x中给出的class的名字冲突,这里创建接口改名为luaClass) | |
function luaClass(base) | |
local superType = type(base) | |
local vtbl = {} | |
local class_type = {} | |
class_type.ctor = false |
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
-- error message monad here | |
data E a = Success a | Error String | |
unitE a = Success a | |
errorE s = Error s | |
(Success a) `bindE` k = k a | |
(Error s) `bindE` k = Error s | |
showE (Success a) = "Success: " ++ showval a | |
showE (Error s) = "Error: " ++ s | |
showpos :: Position -> String |
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
__author__ = 'hzyuxin' | |
import requests | |
from gevent import monkey | |
monkey.patch_all() | |
import gevent | |
main_url = 'http://www.cellmap.cn/cellmap_gsm2gps_api.aspx' | |
def job(lac, cell): |
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
a = {} | |
a["__realdata"] = {} | |
a["__realdata"]["a"] = 1 -- save const a | |
a["__realdata"]["b"] = 2 -- save const b | |
local function const_index(o, key) return o["__realdata"][key] end | |
local function const_newindex(o, key, value) return end | |
setmetatable(a, {__index = const_index, __newindex = const_newindex}) | |
print(a["a"]) | |
print(a["b"]) |
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
require "src/modules/traceback.lua" | |
hook_tb = {} | |
local function hook_index(o, key) | |
local function_name, filename, line = traceback.getsource(4) | |
logger:fatal("access hook_tb in funtion[%s] filename[%s] line[%d]", function_name, filename, line) |
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
rpc_lua = {} | |
function rpc_lua:call(fn_name, ...) | |
return self[fn_name](self, ...) | |
end | |
function rpc_lua:test1(arg1, arg2, arg3) | |
print "test1" | |
end |
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
rpc_lua = {} | |
function rpc_lua:call(fn_name, ...) | |
return self[fn_name](self, ...) | |
end | |
function rpc_lua:test1(arg1, arg2, arg3) | |
print "test1" | |
end |
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
* Generate classes like WhereNot automatically with class decorator? | |
* Haskell style deconstruction, perhaps like: | |
@pmatch | |
def count(first_arg=Match(x=Head, *xs=Rest)): | |
print x, xs | |
Will require some nasty hacks like https://github.com/smcq/python-inject | |
* Implement boolean operators for stuff like: | |
@pmatch |
NewerOlder