Recent
markdown: {
config: (md: MarkdownIt) => {
md.use(require('markdown-it-container'), 'netease', {
validate: function(params) {
return params.trim().match(/^netease\s+(.*)$/);
},
render: function (tokens, idx) {
const m = tokens[idx].info.trim().match(/^netease\s+(.*)$/);
if (tokens[idx].nesting === 1) {
return `<div id="music"><iframe style="border: 0; margin-left: -10px; width: 298px; height: 52px" src="//music.163.com/outchain/player?type=2&id=` + md.utils.escapeHtml(m[1]) + `&auto=1&height=32"></iframe></div>`;
} else {
return "";
}
}
});
md.use(require('markdown-it-container'), 'youtube', {
validate: function(params) {
return params.trim().match(/^youtube\s+(.*)$/);
},
render: function (tokens, idx) {
const m = tokens[idx].info.trim().match(/^youtube\s+(.*)$/);
if (tokens[idx].nesting === 1) {
return `<div id="video"><iframe style="width: 100%; height: 387px" type="text/html" src="https://www.youtube.com/embed/` + md.utils.escapeHtml(m[1]) + `?autoplay=1&loop=1&rel=0&showinfo=0&playlist=` + md.utils.escapeHtml(m[1]) + `" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`;
} else {
return "";
}
}
});
}
},
ALTER TABLE `user` ADD `age` int NOT NULL DEFAULT '0' COMMENT '年龄',
ALGORITHM=Inplace,
LOCK=NONE;
来源:https://www.cnblogs.com/yidengjiagou/p/16769180.html
import csv
header = ['id', 'name', 'age']
data = [[1, 'zhangsan', 20], [2, 'lisi', 25]]
with open (filename, "w", newline='', encoding='utf-8') as csv_file :
writer = csv.writer(csv_file)
writer.writerow(header)
writer.writerows(data)
csv_file.close()
import requests
import json
headers = {'content-type': 'application/json'}
data = {'key':'value'}
response = requests.post(url, json=data, headers=hd)
res = json.loads(response.text)
module.exports = {
devServer: {
proxy: {
'/repos': {
target: 'https://api.github.com', //接口域名
changeOrigin: true, //是否跨域
ws: true, //是否代理 websockets
secure: true, //是否https接口
pathRewrite: { //路径重置
'^/repos': ''
}
}
}
}
};
public class SpringContextHolder implements ApplicationContextAware {
private static ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
SpringContextHolder.applicationContext = applicationContext;
}
public static <T> T getBean(Class<T> clazz) {
return applicationContext.getBean(clazz);
}
public static <T> T getBean(String name, Class<T> clazz) {
return applicationContext.getBean(name, clazz);
}
}
String classInfo = "Class=2,Teacher=Lisa,StudentNum=30";
// 该方法按照每单个字符逐个分割
System.out.println(StringUtils.split(classInfo, ",PC")[0]); // lass=2
// 该方法将字符串当成一个整体去分割
System.out.println(StringUtils.splitByWholeSeparator(classInfo, ",PC")[0]); // Class=2,Teacher=Lisa,StudentNum=30