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
function readOnly( t ) | |
local proxy = {} | |
local mt = { | |
__index = t, | |
__newindex = function ( t, k, v ) | |
error("attempt to update a read-only table", 2) | |
end | |
} | |
setmetatable(proxy, mt) | |
return proxy |
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
JAN = 31 | |
daysFeb = {28, 29} | |
MAR = 31 | |
APR = 30 | |
MAY = 31 | |
JUN = 30 | |
JUL = 31 | |
AUG = 31 |
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
http://linux.itwaka.com/administer/69448.html | |
sudo apt-get install libnss3-tools | |
最终执行如下命令导入根证书: | |
certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n <证书别名> -i <证书文件> |
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
http://hi.baidu.com/zhmsong/blog/item/7cb17eeaddca8adad539c977.html | |
:s/XXX/YYY/g | |
其中XXX是需要替换的字符串,YYY是替换后的字符串 | |
以上这句只对当前行进行替换,如果需要进行全局替换,则要: | |
%s/XXX/YYY/g | |
如果需要对指定部分进行替换,可以用V进入visual模式,再进行 | |
:s/XXX/YYY/g | |
或者可以指定行数对指定范围进行替换: |
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
出现fatal: remote origin already exists. git,可是我就是没有弄过,不知道怎么解决耗了挺久,在网页上看就是没看出来,把网页上的仓库删了还出这个错误,终于找到方法git remote rm origin | |
重新git remote add origin git@github.com:young001/personal_config.git | |
最后git push origin master |
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
GameConfig = {} | |
GameConfig.CnfCity= | |
{ | |
[1] = { | |
name = [[testname]], | |
value = 1, | |
list = { | |
{100, 1, 2000, 100, 0, 3, 1, 0, }, | |
{101, 3, 2001, 101, 4, 3, 1, 1, }, | |
{102, 3, 2002, 100, 0, 3, 1, 0, }, |
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
t = {[2] = 2} | |
local count = 0 | |
for k,v in pairs(t) do | |
count = count + 1 | |
end | |
print(count) |
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
local t1 = os.time{year = 2012, month = 12, day = 19, hour = 0, sec = 0} | |
local t2 = os.time{year = 2012, month = 12, day = 19, hour = 23, sec = 59} | |
if (t1 - t2) <= 86400 and | |
(os.date("%d", t1) ~= os.date("%d",t2)) then | |
-- 判断是否有新手目标 | |
print("called") | |
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
Window = {} -- create a namespace | |
-- create the prototype with default values | |
Window.prototype = {x=0, y=0, width=100, height=100} | |
Window.mt = {} --create a metatable | |
--declare the constructor function | |
function Window.new( o ) | |
setmetatable(o, Window.mt) | |
return o |
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
t = {} | |
--keep a private access to the original table | |
local _t = t | |
--create proxy | |
t = {} | |
--create metatable |
NewerOlder