Skip to content

Instantly share code, notes, and snippets.

View aoxu's full-sized avatar

Ao Xu aoxu

View GitHub Profile
@aoxu
aoxu / luaCaller.lua
Created August 2, 2013 11:53
之前的luaCaller
function luaCaller(module, func, params)
if(params=="") then
tableParams ={}
else
tableParams = json.decode(params)
end
luaFunc =loadstring("return " .. module .. "." .. func .. "(tableParams)");
result = luaFunc()
return json.encode(result)
end
@aoxu
aoxu / luaCaller.lua
Created August 2, 2013 11:54
改进后的luaCaller
function luaErrHandler(err)
print("lua error", err)
print(debug.traceback())
os.exit() -- force exit
end
function luaCaller(module, func, params)
if(params=="") then
tableParams ={}
else
lua error [string "module/battle.lua"]:51: attempt to call global 'xxx' (a nil value)
stack traceback:
[string "main.lua"]:22: in function 'xxx'
[string "module/battle.lua"]:51: in function 'doSth'
[string "module/battle.lua"]:55: in function <[string "module/battle.lua"]:54>
(tail call): ?
[C]: in function 'xpcall'
[string "main.lua"]:34: in function <[string "main.lua"]:26>
lua error [string "module/battle.lua"]:51: attempt to call global 'xxx' (a nil value)
stack traceback:
[string "main.lua"]:22: in function 'xxx'
[string "module/battle.lua"]:51: in function 'doSth'
[string "module/battle.lua"]:55: in function <[string "module/battle.lua"]:54>
(tail call): ?
[C]: in function 'xpcall'
[string "main.lua"]:34: in function <[string "main.lua"]:26>
@aoxu
aoxu / install_package_control.py
Last active December 24, 2015 00:09
给Sublime Text 3安装Package Control。
import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())
@aoxu
aoxu / macapps.txt
Created October 25, 2013 13:02
我安装的Mac Apps
4 Elements (Premium).app
4Video MP4 Converter.app
Adium.app
AirServer.app
Alfred 2.app
AliWangwang.app
Any Screen Record Pro.app
App Store.app
App2Dmg.app
AppCleaner.app
@aoxu
aoxu / closure.lua
Created November 15, 2013 12:42
这是一个Lua闭包的示例。
local function x()
local a = 1
local function y()
print(a)
end
if 1 > 0 then
local function z()
end
end
@aoxu
aoxu / ARMv7.asm
Created November 28, 2013 10:36
from iPad 3
ldr r1, [sp, #88]
ldr r0, [sp, #60]
vldr s0, [r1]
ldr.w r0, [r10, r0]
vmul.f32 d16, d14, d0
ldr r1, [sp, #68]
vadd.f32 d16, d15, d16
vadd.f32 d16, d11, d16
vcvt.u32.f32 d0, d16
vmov r2, s0
@aoxu
aoxu / youtube.md
Created December 4, 2013 06:36
在Markdown中嵌入youtube视频的写法。

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

@aoxu
aoxu / vimeo.md
Created December 4, 2013 06:47
测试iframe嵌入视频。