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
db.getCollection('years3').find().forEach(function(doc) { | |
var a = String(doc.date); | |
var d = new Date(a.substr(0,4)+'/'+a.substr(4,2)+'/'+a.substr(6,2)); | |
db.getCollection('years3').update( {_id: doc._id}, {$set: {date: d}}); | |
}); |
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
def cors(func): | |
@wraps(func) | |
def wrapper_func(*args, **kwargs): | |
r = make_response(func(*args, **kwargs)) | |
# list your access domain here | |
# if set 'Access-Control-Allow-Credentials', this cannot be *. | |
# must match the require domain | |
r.headers['Access-Control-Allow-Origin'] = '*' | |
r.headers['Access-Contorl-Allow-Methods'] = 'GET, POST, PUT, DELETE' # list your access methods here | |
allow_headers = "Referer, Accept, Origin, User-Agent" |
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
<form id="id-form" hidden="hidden"> | |
<input id="id-input" type="text" title="input"> | |
<input id="id-input-submit" type="submit" value="submit"> | |
</form> | |
<button id="id-button-toggle" data-hide="show-form" data-show="hide-form">show</button> | |
<script src="toggle-button-key.js"></script> |
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
# coding: utf-8 | |
__author__ = 'Jux.Liu' | |
# (folder, blueprint, prefix) | |
INSTALLED_MODULES = [ | |
('routes', 'main', '/'), | |
('api', 'api', '/api'), | |
('routes', 'store', '/') | |
] |
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 cloneObject(obj) { | |
if (obj === null || typeof obj !== 'object') { | |
return obj | |
} | |
var temp = new obj.constructor() // give temp the original obj's constructor | |
for (var key in obj) { | |
temp[key] = cloneObject(obj[key]) | |
} | |
return temp | |
} |
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
# 安装方便易用防火墙 | |
apt-get install ufw | |
# 复制以下命令 | |
ufw allow 22 | |
ufw allow 80 | |
ufw allow 443 | |
ufw default deny incoming | |
ufw default allow outgoing | |
ufw status verbose |
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
GroupAdd OneNoteGroup, ahk_exe onenote.exe | |
GroupAdd Xshell, ahk_exe Xshell.exe | |
GroupAdd Firefox, ahk_exe firefox.exe | |
GroupAdd VSCode, ahk_exe Code.exe | |
GroupAdd gitbash, ahk_exe mintty.exe | |
;;上加一行 | |
$^+o:: | |
Send {Home}{Enter}{Up} | |
return |
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
class Model(object): | |
""" | |
Model 是所有 model 的基类 | |
@classmethod 是一个套路用法 | |
例如 | |
user = User() | |
user.db_path() 返回 User.txt | |
""" | |
@classmethod | |
def db_path(cls): |
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 addBitFront(str, length, bit) { | |
// 字符串指定长度,不足则在前段补位 | |
// str: 待补位的字符串 | |
// length: 指定的长度 | |
// bit: 补位的字符 | |
let new_str = '' | |
if (str.length < length) { | |
new_str = new Array(length - str.length + 1).join(bit) + str // 必须 + 1,否则得到的补位字符串会少 1 位 | |
} | |
return new_str; |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
<style type="text/css"> | |
#topmenu | |
{top:0; | |
width:100%; | |
position:fixed; |